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.
246 247 248 249 250 251 |
# File 'lib/flipper/cli.rb', line 246 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.
244 245 246 |
# File 'lib/flipper/cli.rb', line 244 def description @description end |
#load_environment ⇒ Object
Returns the value of attribute load_environment.
244 245 246 |
# File 'lib/flipper/cli.rb', line 244 def load_environment @load_environment end |
Instance Method Details
#action(&block) ⇒ Object
258 259 260 |
# File 'lib/flipper/cli.rb', line 258 def action(&block) @action = block end |
#run(argv) ⇒ Object
253 254 255 256 |
# File 'lib/flipper/cli.rb', line 253 def run(argv) # Parse argv and call action with arguments @action.call(*permute(argv)) end |