Class: IO::Event::Timers::Handle
- Inherits:
-
Object
- Object
- IO::Event::Timers::Handle
- Defined in:
- lib/io/event/timers.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #<(other) ⇒ Object
- #>(other) ⇒ Object
- #call ⇒ Object
- #cancel! ⇒ Object
- #cancelled? ⇒ Boolean
-
#initialize(time, block) ⇒ Handle
constructor
A new instance of Handle.
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
#block ⇒ Object (readonly)
Returns the value of attribute block.
26 27 28 |
# File 'lib/io/event/timers.rb', line 26 def block @block end |
#time ⇒ Object (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 |
#call ⇒ Object
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
36 37 38 |
# File 'lib/io/event/timers.rb', line 36 def cancelled? @block.nil? end |