Class: Flipper::CLI::Command
- Inherits:
-
OptionParser
- Object
- OptionParser
- Flipper::CLI::Command
- Defined in:
- lib/flipper/cli.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#load_environment ⇒ Object
Returns the value of attribute load_environment.
Instance Method Summary collapse
- #action(&block) ⇒ Object
-
#initialize(program_name: nil) ⇒ Command
constructor
A new instance of Command.
- #run(argv) ⇒ Object
Constructor Details
#initialize(program_name: nil) ⇒ Command
Returns a new instance of Command.
297 298 299 300 301 302 |
# File 'lib/flipper/cli.rb', line 297 def initialize(program_name: nil) super() @program_name = program_name @load_environment = true @action = lambda { } end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
295 296 297 |
# File 'lib/flipper/cli.rb', line 295 def description @description end |
#load_environment ⇒ Object
Returns the value of attribute load_environment.
295 296 297 |
# File 'lib/flipper/cli.rb', line 295 def load_environment @load_environment end |
Instance Method Details
#action(&block) ⇒ Object
309 310 311 |
# File 'lib/flipper/cli.rb', line 309 def action(&block) @action = block end |
#run(argv) ⇒ Object
304 305 306 307 |
# File 'lib/flipper/cli.rb', line 304 def run(argv) # Parse argv and call action with arguments @action.call(*permute(argv)) end |