Class: RedisRing::CLI
- Inherits:
-
Object
- Object
- RedisRing::CLI
- Defined in:
- lib/redis_ring/cli.rb
Constant Summary collapse
- COMMANDS =
[:help, :start]
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
9 10 11 |
# File 'lib/redis_ring/cli.rb', line 9 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
7 8 9 |
# File 'lib/redis_ring/cli.rb', line 7 def argv @argv end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/redis_ring/cli.rb', line 13 def run command = argv[0] if command.nil? || !COMMANDS.include?(command.to_sym) usage exit(1) else send(command, *argv[1..-1]) exit(0) end end |