Module: OpenHAB::CoreExt::Java::Time
- Included in:
 - LocalDate, Month, MonthDay, ZonedDateTime
 
- Defined in:
 - lib/openhab/core_ext/java/time.rb
 
Overview
Common extensions to Java Date/Time classes
Instance Method Summary collapse
- 
  
    
      #<=>(other)  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Compare against another time object.
 - 
  
    
      #coerce(other)  ⇒ Array? 
    
    
  
  
  
  
  
  
  
  
  
    
Convert
otherto this class, if possible. 
Instance Method Details
#<=>(other) ⇒ Integer
Compare against another time object
      40 41 42 43 44 45 46 47 48  | 
    
      # File 'lib/openhab/core_ext/java/time.rb', line 40 def <=>(other) if other.is_a?(self.class) compare_to(other) elsif other.respond_to?(:coerce) return nil unless (lhs, rhs = other.coerce(self)) lhs <=> rhs end end  | 
  
#coerce(other) ⇒ Array?
Convert other to this class, if possible
      52 53 54 55 56 57 58  | 
    
      # File 'lib/openhab/core_ext/java/time.rb', line 52 def coerce(other) coercion_method = self.class.coercion_method return unless other.respond_to?(coercion_method) return [other.send(coercion_method), self] if other.method(coercion_method).arity.zero? [other.send(coercion_method, self), self] end  |