An open API service indexing awesome lists of open source software.

https://github.com/siman-man/shiritori

try to create long method chain.
https://github.com/siman-man/shiritori

gem ruby

Last synced: about 1 month ago
JSON representation

try to create long method chain.

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/siman-man/shiritori.svg?branch=master)](https://travis-ci.org/siman-man/shiritori)
[![Code Climate](https://codeclimate.com/github/siman-man/shiritori.png)](https://codeclimate.com/github/siman-man/shiritori)
[![Coverage Status](https://coveralls.io/repos/siman-man/shiritori/badge.png)](https://coveralls.io/r/siman-man/shiritori)

# Shiritori

Let's try to create too long method chain!

## Installation

install it yourself as:

$ gem install shiritori

Let's start creation long method chain.

## Rule

1. You set first object.

2. Input the method that object can use.
* You can not use the method that has been used once.
* Don't override or define new method.

3. It continue until the method can not be input.

4. Let's enjoy shiritori!

- block syntax can use only '{}', not use 'do - end' syntax.
- if you want to pass arguments, please enclosed '()'.

bad

```
Please input next method > +5
Exec command 3.+5
```

good

```
Please input next method > +(5)
Exec command 3.+(5)
```

## Usage

```
% shiritori start

+--------------------------------------------------+
| |
| Welcome to the Shiritori! |
| |
+--------------------------------------------------+
Please input first object > "Hello"

+----------------------+
| Current method chain |
+----------------------+
| "Hello" |
+----------------------+

+---------------+-------------+----------------+
| Current Class | Chain Count | Current Object |
+---------------+-------------+----------------+
| String | 0 | "Hello" |
+---------------+-------------+----------------+

Please input next method > chars
Exec command "Hello".chars

+----------------------+
| Current method chain |
+----------------------+
| "Hello".chars |
+----------------------+

+---------------+-------------+---------------------------+
| Current Class | Chain Count | Current Object |
+---------------+-------------+---------------------------+
| Array | 1 | ["H", "e", "l", "l", "o"] |
+---------------+-------------+---------------------------+

Success!

Please input next method > first
Exec command ["H", "e", "l", "l", "o"].first

+----------------------+
| Current method chain |
+----------------------+
| "Hello".chars.first |
+----------------------+

+---------------+-------------+----------------+
| Current Class | Chain Count | Current Object |
+---------------+-------------+----------------+
| String | 2 | "H" |
+---------------+-------------+----------------+

Success!

Please input next method >
```

## Contributing

1. Fork it ( https://github.com/siman-man/shiritori/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request