Class: ScripTTY::Net::EventLoop::Timer
- Inherits:
-
Object
- Object
- ScripTTY::Net::EventLoop::Timer
- Defined in:
- lib/scriptty/net/event_loop.rb
Instance Attribute Summary collapse
-
#expire_at ⇒ Object
readonly
Returns the value of attribute expire_at.
Instance Method Summary collapse
- #cancel ⇒ Object
- #daemon? ⇒ Boolean
-
#initialize(master, expire_at, callback, options = {}) ⇒ Timer
constructor
A new instance of Timer.
Constructor Details
#initialize(master, expire_at, callback, options = {}) ⇒ Timer
Returns a new instance of Timer.
605 606 607 608 609 610 |
# File 'lib/scriptty/net/event_loop.rb', line 605 def initialize(master, expire_at, callback, ={}) @master = master @expire_at = expire_at @callback = callback @daemon = !![:daemon] # if true, we won't hold up the main loop (just like a daemon thread) end |
Instance Attribute Details
#expire_at ⇒ Object (readonly)
Returns the value of attribute expire_at.
604 605 606 |
# File 'lib/scriptty/net/event_loop.rb', line 604 def expire_at @expire_at end |
Instance Method Details
#cancel ⇒ Object
616 617 618 |
# File 'lib/scriptty/net/event_loop.rb', line 616 def cancel @master.send(:cancel_timer, self) end |
#daemon? ⇒ Boolean
612 613 614 |
# File 'lib/scriptty/net/event_loop.rb', line 612 def daemon? @daemon end |