Skip to content

siman-man/shiritori

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Code Climate Coverage Status

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.
  1. It continue until the method can not be input.

  2. 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

About

try to create long method chain.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages