Class: Shanty::TaskSet
- Inherits:
-
Object
- Object
- Shanty::TaskSet
- Defined in:
- lib/shanty/task_set.rb
Overview
Public: Discover shanty tasks
Direct Known Subclasses
Class Attribute Summary collapse
-
.partial_task ⇒ Object
readonly
Returns the value of attribute partial_task.
-
.task_sets ⇒ Object
readonly
Returns the value of attribute task_sets.
-
.tasks ⇒ Object
readonly
Returns the value of attribute tasks.
Class Method Summary collapse
- .desc(syntax, desc) ⇒ Object
-
.inherited(task_set) ⇒ Object
This method is auto-triggered by Ruby whenever a class inherits from Shanty::TaskSet.
- .method_added(name) ⇒ Object
- .option(name, options = {}) ⇒ Object
- .param(name, options = {}) ⇒ Object
Class Attribute Details
.partial_task ⇒ Object (readonly)
Returns the value of attribute partial_task.
5 6 7 |
# File 'lib/shanty/task_set.rb', line 5 def partial_task @partial_task end |
.task_sets ⇒ Object (readonly)
Returns the value of attribute task_sets.
5 6 7 |
# File 'lib/shanty/task_set.rb', line 5 def task_sets @task_sets end |
.tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
5 6 7 |
# File 'lib/shanty/task_set.rb', line 5 def tasks @tasks end |
Class Method Details
.desc(syntax, desc) ⇒ Object
16 17 18 19 |
# File 'lib/shanty/task_set.rb', line 16 def self.desc(syntax, desc) partial_task[:syntax] = syntax partial_task[:desc] = desc end |
.inherited(task_set) ⇒ Object
This method is auto-triggered by Ruby whenever a class inherits from Shanty::TaskSet. This means we can build up a list of all the tasks without requiring them to register with us - neat!
11 12 13 14 |
# File 'lib/shanty/task_set.rb', line 11 def self.inherited(task_set) @task_sets ||= [] @task_sets << task_set end |
.method_added(name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/shanty/task_set.rb', line 29 def self.method_added(name) @tasks ||= {} @tasks[name] = partial_task.merge(klass: self) # Now reset the task definition. @partial_task = {} end |
.option(name, options = {}) ⇒ Object
25 26 27 |
# File 'lib/shanty/task_set.rb', line 25 def self.option(name, = {}) partial_task[:options][name] = end |
.param(name, options = {}) ⇒ Object
21 22 23 |
# File 'lib/shanty/task_set.rb', line 21 def self.param(name, = {}) partial_task[:params][name] = end |