class Shanty::TaskSet
Public: Discover shanty tasks
Attributes
partial_task[R]
task_sets[R]
tasks[R]
Public Class Methods
desc(syntax, desc)
click to toggle source
# 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)
click to toggle source
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!
# File lib/shanty/task_set.rb, line 11 def self.inherited(task_set) @task_sets ||= [] @task_sets << task_set end
method_added(name)
click to toggle source
# 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 = {})
click to toggle source
# File lib/shanty/task_set.rb, line 25 def self.option(name, options = {}) partial_task[:options][name] = options end
param(name, options = {})
click to toggle source
# File lib/shanty/task_set.rb, line 21 def self.param(name, options = {}) partial_task[:params][name] = options end