Class: Tmtms::Timer::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/tmtms/timer.rb

Overview

Timer job

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timer:, time:, repeat: nil, block:) ⇒ Job

Returns a new instance of Job.

Parameters:



18
19
20
# File 'lib/tmtms/timer.rb', line 18

def initialize(timer:, time:, repeat: nil, block:)
  @timer, @time, @repeat, @block = timer, time, repeat, block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



13
14
15
# File 'lib/tmtms/timer.rb', line 13

def block
  @block
end

#repeatObject (readonly)

Returns the value of attribute repeat.



13
14
15
# File 'lib/tmtms/timer.rb', line 13

def repeat
  @repeat
end

#timeObject

Returns the value of attribute time.



12
13
14
# File 'lib/tmtms/timer.rb', line 12

def time
  @time
end

Instance Method Details

#cancelself

cancel this job.

Returns:

  • (self)


24
25
26
# File 'lib/tmtms/timer.rb', line 24

def cancel
  @timer.cancel(self)
end