Class: New::Task
- Inherits:
-
Object
- Object
- New::Task
- Defined in:
- lib/new/task.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project_config) ⇒ Task
constructor
A new instance of Task.
- #name ⇒ Object
-
#options ⇒ Object
Return only the options for the given task.
-
#project_options ⇒ Object
Return ALL available options.
Constructor Details
#initialize(project_config) ⇒ Task
Returns a new instance of Task.
8 9 10 11 |
# File 'lib/new/task.rb', line 8 def initialize project_config @project_config = project_config run end |
Class Method Details
.inherited(task_class) ⇒ Object
4 5 6 |
# File 'lib/new/task.rb', line 4 def self.inherited task_class task_class.name = caller.first[/[a-z_]+?(?=\.rb)/].to_sym end |
.name ⇒ Object
16 |
# File 'lib/new/task.rb', line 16 def self.name; @name; end |
.name=(name) ⇒ Object
13 14 15 |
# File 'lib/new/task.rb', line 13 def self.name= name @name = name end |
Instance Method Details
#name ⇒ Object
17 |
# File 'lib/new/task.rb', line 17 def name; self.class.name.to_sym; end |
#options ⇒ Object
Return only the options for the given task
35 36 37 38 |
# File 'lib/new/task.rb', line 35 def = self.class::OPTIONS rescue {} @options ||= .deep_merge([:tasks][name]) end |
#project_options ⇒ Object
Return ALL available options
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/new/task.rb', line 21 def = New.custom_config = .deep_merge(@project_config) # Groom tasks (prevent tasks from the custom config from polluting the project config) [:tasks].each_key do |task| [:tasks].delete(task) unless @project_config[:tasks].has_key?(task) end @project_options ||= end |