Class: IO::Event::Timers::Handle

Inherits:
Object
  • Object
show all
Defined in:
lib/io/event/timers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, block) ⇒ Handle

Returns a new instance of Handle.



12
13
14
15
# File 'lib/io/event/timers.rb', line 12

def initialize(time, block)
	@time = time
	@block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



26
27
28
# File 'lib/io/event/timers.rb', line 26

def block
  @block
end

#timeObject (readonly)

Returns the value of attribute time.



25
26
27
# File 'lib/io/event/timers.rb', line 25

def time
  @time
end

Instance Method Details

#<(other) ⇒ Object



17
18
19
# File 'lib/io/event/timers.rb', line 17

def < other
	@time < other.time
end

#>(other) ⇒ Object



21
22
23
# File 'lib/io/event/timers.rb', line 21

def > other
	@time > other.time
end

#callObject



28
29
30
# File 'lib/io/event/timers.rb', line 28

def call(...)
	@block.call(...)
end

#cancel!Object



32
33
34
# File 'lib/io/event/timers.rb', line 32

def cancel!
	@block = nil
end

#cancelled?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/io/event/timers.rb', line 36

def cancelled?
	@block.nil?
end