Class: LetItFall::CLI
- Inherits:
-
Thor
- Object
- Thor
- LetItFall::CLI
- Defined in:
- lib/let_it_fall/cli.rb
Instance Method Summary collapse
- #code(*code) ⇒ Object
- #go ⇒ Object
- #list ⇒ Object
- #matrix(mark = :latins) ⇒ Object
- #rand ⇒ Object
- #version ⇒ Object
Instance Method Details
#code(*code) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/let_it_fall/cli.rb', line 46 def code(*code) if [:range] st, ed = code.minmax code = Range.new(st.to_i(16), ed.to_i(16)) .to_a.map { |i| i.to_s(16) } end run(code, [:speed], [:color], [:matrix]) end |
#go ⇒ Object
35 36 37 38 |
# File 'lib/let_it_fall/cli.rb', line 35 def go code = LetItFall::CODESET.keys.sample run(code, [:speed], [:color], false, [:interval]) end |
#list ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/let_it_fall/cli.rb', line 56 def list puts "Commands:" puts " let_it_fall MARK # Let any of following MARKs fall" LetItFall::CODESET.keys.sort.each_with_index do |mark, i| print "\n " if i%8==0 print mark, " " end puts "\n\n" puts " let_it_fall matrix [MARK] # Let it matrix!" puts " let_it_fall rand # Let something fall randomly" puts " let_it_fall go # Let them Go!" puts " let_it_fall code CODE # Let specific character fall by unicode(s) ex. code 0x2660" puts " let_it_fall help [COMMAND] # Describe available commands or one specific command" puts " let_it_fall version # Show LetItFall version" end |
#matrix(mark = :latins) ⇒ Object
27 28 29 |
# File 'lib/let_it_fall/cli.rb', line 27 def matrix(mark=:latins) run(mark, [:speed], [:color], true) end |