Class: Nova::Task
- Inherits:
-
Object
- Object
- Nova::Task
- Defined in:
- lib/cocoanova/task.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Compile
Constant Summary collapse
- Tasks =
{}
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .invoke(name, params = {}) ⇒ Object
- .require_all ⇒ Object
-
.task(*names) ⇒ Object
For Register.
Instance Method Summary collapse
-
#invoke(params = {}) ⇒ Object
For subclassing.
Class Method Details
.[](key) ⇒ Object
11 12 13 |
# File 'lib/cocoanova/task.rb', line 11 def self.[](key) Tasks[key.to_sym] || [] end |
.[]=(key, value) ⇒ Object
15 16 17 18 |
# File 'lib/cocoanova/task.rb', line 15 def self.[]=(key, value) Tasks[key.to_sym] ||= [] Tasks[key.to_sym] << value end |
.invoke(name, params = {}) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/cocoanova/task.rb', line 20 def self.invoke(name, params = {}) total = self[name].count raise "Task #{name} not found" if total == 0 self[name].each_with_index do |task, idx| puts "===> #{idx + 1}/#{total} #{task}" task.new.invoke(params) end end |
.require_all ⇒ Object
7 8 9 |
# File 'lib/cocoanova/task.rb', line 7 def self.require_all Nova.require_folder :tasks end |
Instance Method Details
#invoke(params = {}) ⇒ Object
For subclassing
39 40 |
# File 'lib/cocoanova/task.rb', line 39 def invoke(params = {}) end |