Class: Healthety::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/healthety/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Worker

Returns a new instance of Worker.



5
6
7
8
# File 'lib/healthety/worker.rb', line 5

def initialize(name, &block)
  @name = name.to_s
  @block = block
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/healthety/worker.rb', line 3

def name
  @name
end

Instance Method Details

#interval(interval = nil) ⇒ Object



10
11
12
# File 'lib/healthety/worker.rb', line 10

def interval(interval = nil)
  @interval = interval || @interval
end

#performObject



18
19
20
# File 'lib/healthety/worker.rb', line 18

def perform
  instance_eval(&@block)
end

#value(value = nil) ⇒ Object



14
15
16
# File 'lib/healthety/worker.rb', line 14

def value(value = nil)
  @value = value || @value
end