Class: Raktr::Tasks::Base
- Inherits:
-
Object
- Object
- Raktr::Tasks::Base
- Defined in:
- lib/raktr/tasks/base.rb
Overview
Callable task.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#owner ⇒ Tasks
List managing this task.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
abstract
Calls the configured task and passes ‘args` and self` to it.
- #done ⇒ Object
- #hash ⇒ Object
-
#initialize(&task) ⇒ Base
constructor
A new instance of Base.
- #to_proc ⇒ Object
Constructor Details
#initialize(&task) ⇒ Base
Returns a new instance of Base.
22 23 24 25 26 |
# File 'lib/raktr/tasks/base.rb', line 22 def initialize( &task ) fail ArgumentError, 'Missing block.' if !block_given? @task = task end |
Instance Attribute Details
#owner ⇒ Tasks
Returns List managing this task.
19 20 21 |
# File 'lib/raktr/tasks/base.rb', line 19 def owner @owner end |
Instance Method Details
#call(*args) ⇒ Object
This method is abstract.
Calls the configured task and passes ‘args` and self` to it.
31 32 33 |
# File 'lib/raktr/tasks/base.rb', line 31 def call( *args ) fail NotImplementedError end |
#done ⇒ Object
36 37 38 |
# File 'lib/raktr/tasks/base.rb', line 36 def done @owner.delete self end |
#hash ⇒ Object
44 45 46 |
# File 'lib/raktr/tasks/base.rb', line 44 def hash @task.hash end |
#to_proc ⇒ Object
40 41 42 |
# File 'lib/raktr/tasks/base.rb', line 40 def to_proc @task end |