Class: Thor::DynamicCommand
- Defined in:
- lib/skylight/vendor/cli/thor/command.rb
Overview
A dynamic command that handles method missing scenarios.
Constant Summary
Constants inherited from Command
Instance Attribute Summary
Attributes inherited from Command
#description, #long_description, #name, #options, #usage
Instance Method Summary collapse
-
#initialize(name, options = nil) ⇒ DynamicCommand
constructor
A new instance of DynamicCommand.
- #run(instance, args = []) ⇒ Object
Methods inherited from Command
#formatted_usage, #hidden?, #initialize_copy
Constructor Details
#initialize(name, options = nil) ⇒ DynamicCommand
Returns a new instance of DynamicCommand.
122 123 124 |
# File 'lib/skylight/vendor/cli/thor/command.rb', line 122 def initialize(name, =nil) super(name.to_s, "A dynamically-generated command", name.to_s, name.to_s, ) end |
Instance Method Details
#run(instance, args = []) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/skylight/vendor/cli/thor/command.rb', line 126 def run(instance, args=[]) if (instance.methods & [name.to_s, name.to_sym]).empty? super else instance.class.handle_no_command_error(name) end end |