Class: Wristwatch::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/wristwatch/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/wristwatch/task.rb', line 3

def name
  @name
end

Instance Method Details

#callObject



10
11
12
13
# File 'lib/wristwatch/task.rb', line 10

def call
  puts "running '#{name}'"
  @proc.call
end