Class: Serf::Handler::Task
- Inherits:
-
Object
- Object
- Serf::Handler::Task
- Includes:
- Comparable
- Defined in:
- lib/serf/handler/task.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#order ⇒ Object
Returns the value of attribute order.
-
#task ⇒ Object
Returns the value of attribute task.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(another_task) ⇒ Object
- #call(*args) ⇒ Object
-
#initialize(type = :query, name = nil, order = 0, description = '', &task) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(type = :query, name = nil, order = 0, description = '', &task) ⇒ Task
Returns a new instance of Task.
8 9 10 11 12 13 14 |
# File 'lib/serf/handler/task.rb', line 8 def initialize(type = :query, name = nil, order = 0, description = '', &task) @order = order @type = type @name = name @description = description @task = task end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/serf/handler/task.rb', line 6 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/serf/handler/task.rb', line 6 def name @name end |
#order ⇒ Object
Returns the value of attribute order.
6 7 8 |
# File 'lib/serf/handler/task.rb', line 6 def order @order end |
#task ⇒ Object
Returns the value of attribute task.
6 7 8 |
# File 'lib/serf/handler/task.rb', line 6 def task @task end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/serf/handler/task.rb', line 6 def type @type end |
Instance Method Details
#<=>(another_task) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/serf/handler/task.rb', line 16 def <=>(another_task) if @order < another_task.order -1 elsif @order > another_task.order 1 else if @task.to_s < another_task.task.to_s -1 elsif @task.to_s > another_task.task.to_s 1 else 0 end end end |
#call(*args) ⇒ Object
32 33 34 |
# File 'lib/serf/handler/task.rb', line 32 def call(*args) @task.call(*args) if @task end |