Class: Eventkit::Timer
- Inherits:
- 
      Struct
      
        - Object
- Struct
- Eventkit::Timer
 
- Defined in:
- lib/eventkit/timer.rb
Instance Attribute Summary collapse
- 
  
    
      #expires_in  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute expires_in. 
- 
  
    
      #handler  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute handler. 
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #expired? ⇒ Boolean
- 
  
    
      #initialize(seconds, handler)  ⇒ Timer 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Timer. 
Constructor Details
#initialize(seconds, handler) ⇒ Timer
Returns a new instance of Timer.
| 3 4 5 | # File 'lib/eventkit/timer.rb', line 3 def initialize(seconds, handler) super(Time.now.to_f + seconds, handler) end | 
Instance Attribute Details
#expires_in ⇒ Object
Returns the value of attribute expires_in
| 2 3 4 | # File 'lib/eventkit/timer.rb', line 2 def expires_in @expires_in end | 
#handler ⇒ Object
Returns the value of attribute handler
| 2 3 4 | # File 'lib/eventkit/timer.rb', line 2 def handler @handler end | 
Instance Method Details
#<=>(other) ⇒ Object
| 7 8 9 | # File 'lib/eventkit/timer.rb', line 7 def <=>(other) expires_in <=> other.expires_in end | 
#expired? ⇒ Boolean
| 11 12 13 | # File 'lib/eventkit/timer.rb', line 11 def expired? expires_in <= Time.now.to_f end |