Class: Wristwatch::Task
- Inherits:
-
Object
- Object
- Wristwatch::Task
- Defined in:
- lib/wristwatch/task.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*args, &blk) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(*args, &blk) ⇒ Task
Returns a new instance of Task.
4 5 6 7 8 |
# File 'lib/wristwatch/task.rb', line 4 def initialize(*args, &blk) @options = args.last.is_a?(Hash) ? args.last : {} @name = args[0] @proc = blk end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/wristwatch/task.rb', line 3 def name @name end |
Instance Method Details
#call ⇒ Object
10 11 12 13 |
# File 'lib/wristwatch/task.rb', line 10 def call puts "running '#{name}'" @proc.call end |