Class: ScripTTY::Net::EventLoop::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/scriptty/net/event_loop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  @master = master
  @expire_at = expire_at
  @callback = callback
  @daemon = !!options[:daemon]  # if true, we won't hold up the main loop (just like a daemon thread)
end

Instance Attribute Details

#expire_atObject (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

#cancelObject



616
617
618
# File 'lib/scriptty/net/event_loop.rb', line 616

def cancel
  @master.send(:cancel_timer, self)
end

#daemon?Boolean

Returns:

  • (Boolean)


612
613
614
# File 'lib/scriptty/net/event_loop.rb', line 612

def daemon?
  @daemon
end