Class: Green::Hub::Nio4r::Timer
- Inherits:
-
Object
- Object
- Green::Hub::Nio4r::Timer
- Defined in:
- lib/green/hub/nio4r.rb
Instance Attribute Summary collapse
-
#clb ⇒ Object
readonly
Returns the value of attribute clb.
-
#fire_at ⇒ Object
readonly
Returns the value of attribute fire_at.
-
#reactor ⇒ Object
readonly
Returns the value of attribute reactor.
Instance Method Summary collapse
- #<=>(v) ⇒ Object
- #green_cancel ⇒ Object
-
#initialize(reactor, fire_at, &clb) ⇒ Timer
constructor
A new instance of Timer.
- #run ⇒ Object
Constructor Details
#initialize(reactor, fire_at, &clb) ⇒ Timer
Returns a new instance of Timer.
31 32 33 |
# File 'lib/green/hub/nio4r.rb', line 31 def initialize(reactor, fire_at, &clb) @reactor, @fire_at, @clb = reactor, fire_at, clb end |
Instance Attribute Details
#clb ⇒ Object (readonly)
Returns the value of attribute clb.
30 31 32 |
# File 'lib/green/hub/nio4r.rb', line 30 def clb @clb end |
#fire_at ⇒ Object (readonly)
Returns the value of attribute fire_at.
30 31 32 |
# File 'lib/green/hub/nio4r.rb', line 30 def fire_at @fire_at end |
#reactor ⇒ Object (readonly)
Returns the value of attribute reactor.
30 31 32 |
# File 'lib/green/hub/nio4r.rb', line 30 def reactor @reactor end |
Instance Method Details
#<=>(v) ⇒ Object
46 47 48 |
# File 'lib/green/hub/nio4r.rb', line 46 def <=>(v) @fire_at <=> v.fire_at end |
#green_cancel ⇒ Object
40 41 42 43 44 |
# File 'lib/green/hub/nio4r.rb', line 40 def green_cancel return if @canceled || @runned @canceled = true reactor.cancel_timer self end |
#run ⇒ Object
35 36 37 38 |
# File 'lib/green/hub/nio4r.rb', line 35 def run @runned = true clb.call end |