Class: BeerList::CLI
- Inherits:
-
Thor
- Object
- Thor
- BeerList::CLI
- Defined in:
- lib/beer_list/cli.rb
Instance Method Summary collapse
Instance Method Details
#establish(klass) ⇒ Object
17 18 19 20 21 |
# File 'lib/beer_list/cli.rb', line 17 def establish(klass) # Support underscore and camelcase klass = klass.split('_').map(&:capitalize).join if klass.match(/_/) BeerList::EstablishmentGenerator.new(klass, ) end |
#list(*establishments) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/beer_list/cli.rb', line 32 def list(*establishments) configure add_establishments establishments if [:json] puts BeerList.lists_as_json else BeerList.lists.each do |list| puts '*' * (list.establishment.size + 10) puts "**** #{list.establishment} ****" puts '*' * (list.establishment.size + 10) puts puts list puts end end end |
#send(*establishments) ⇒ Object
54 55 56 57 58 |
# File 'lib/beer_list/cli.rb', line 54 def send(*establishments) configure add_establishments establishments puts "Sent!" if BeerList.send_lists end |