Class: Fare::SubscriberCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/fare/subscriber_cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argvObject (readonly)

Returns the value of attribute argv.



6
7
8
# File 'lib/fare/subscriber_cli.rb', line 6

def argv
  @argv
end

#commandObject (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

#callObject



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