Class: Taskr::Task
- Inherits:
-
Object
- Object
- Taskr::Task
- Defined in:
- lib/taskr/task.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, action, description) ⇒ Task
constructor
A new instance of Task.
- #run ⇒ Object
Constructor Details
#initialize(name, action, description) ⇒ Task
Returns a new instance of Task.
5 6 7 8 9 10 |
# File 'lib/taskr/task.rb', line 5 def initialize(name, action, description) raise ArgumentError.new('Action is not callable') unless action.respond_to? :call @name = name @action = action @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/taskr/task.rb', line 3 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/taskr/task.rb', line 3 def name @name end |
Instance Method Details
#run ⇒ Object
11 12 13 |
# File 'lib/taskr/task.rb', line 11 def run @action.call end |