Class: Fare::SubscriberCLI
- Inherits:
-
Object
- Object
- Fare::SubscriberCLI
- Defined in:
- lib/fare/subscriber_cli.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv) ⇒ SubscriberCLI
constructor
A new instance of SubscriberCLI.
Constructor Details
#initialize(argv) ⇒ SubscriberCLI
Returns a new instance of SubscriberCLI.
8 9 10 11 |
# File 'lib/fare/subscriber_cli.rb', line 8 def initialize(argv) @command = argv.shift @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
6 7 8 |
# File 'lib/fare/subscriber_cli.rb', line 6 def argv @argv end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/fare/subscriber_cli.rb', line 6 def command @command end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fare/subscriber_cli.rb', line 13 def call case command when nil, "-h", "--help", "help" show_help exit 0 when "start" start when "stop" stop when "status" status when "restart" restart else puts "Unkown command: #{command}" puts show_help exit 1 end end |