Class: Thor::DynamicTask

Inherits:
Task show all
Defined in:
lib/vendor/thor/lib/thor/task.rb

Overview

A dynamic task that handles method missing scenarios.

Constant Summary

Constants inherited from Task

Task::FILE_REGEXP

Instance Attribute Summary

Attributes inherited from Task

#description, #long_description, #name, #options, #usage

Instance Method Summary collapse

Methods inherited from Task

#formatted_usage, #hidden?, #initialize_copy

Methods inherited from Struct

#as_json, json_create, #to_json

Constructor Details

#initialize(name, options = nil) ⇒ DynamicTask

Returns a new instance of DynamicTask.



120
121
122
# File 'lib/vendor/thor/lib/thor/task.rb', line 120

def initialize(name, options=nil)
  super(name.to_s, "A dynamically-generated task", name.to_s, name.to_s, options)
end

Instance Method Details

#run(instance, args = []) ⇒ Object



124
125
126
127
128
129
130
# File 'lib/vendor/thor/lib/thor/task.rb', line 124

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