Class: Thor::Task::Dynamic
- Inherits:
-
Thor::Task
- Object
- Struct
- Thor::Task
- Thor::Task::Dynamic
- Defined in:
- lib/vendor/thor/lib/thor/task.rb
Overview
A dynamic task that handles method missing scenarios.
Constant Summary
Constants inherited from Thor::Task
Instance Attribute Summary
Attributes inherited from Thor::Task
#description, #name, #options, #usage
Instance Method Summary collapse
-
#initialize(name, options = nil) ⇒ Dynamic
constructor
A new instance of Dynamic.
- #run(instance, args = []) ⇒ Object
Methods inherited from Thor::Task
#formatted_usage, #initialize_copy
Methods inherited from Struct
Constructor Details
#initialize(name, options = nil) ⇒ Dynamic
Returns a new instance of Dynamic.
7 8 9 |
# File 'lib/vendor/thor/lib/thor/task.rb', line 7 def initialize(name, =nil) super(name.to_s, "A dynamically-generated task", name.to_s, ) end |
Instance Method Details
#run(instance, args = []) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/vendor/thor/lib/thor/task.rb', line 11 def run(instance, args=[]) if (instance.methods & [name.to_s, name.to_sym]).empty? super else instance.class.handle_no_task_error(name) end end |