Class: Thor::DynamicTask
Overview
A dynamic task that handles method missing scenarios.
Constant Summary
Constants inherited from Task
Instance Attribute Summary
Attributes inherited from Task
#description, #long_description, #name, #options, #usage
Instance Method Summary collapse
-
#initialize(name, options = nil) ⇒ DynamicTask
constructor
A new instance of DynamicTask.
- #run_cmd(instance, args = []) ⇒ Object
Methods inherited from Task
#formatted_usage, #hidden?, #initialize_copy
Constructor Details
#initialize(name, options = nil) ⇒ DynamicTask
Returns a new instance of DynamicTask.
117 118 119 |
# File 'lib/thor/task.rb', line 117 def initialize(name, =nil) super(name.to_s, "A dynamically-generated task", name.to_s, name.to_s, ) end |
Instance Method Details
#run_cmd(instance, args = []) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/thor/task.rb', line 121 def run_cmd(instance, args=[]) if (instance.methods & [name.to_s, name.to_sym]).empty? super else instance.class.handle_no_task_error(name) end end |