Class: OpenHAB::CoreExt::Java::LocalTime
- Inherits:
- 
      Object
      
        - Object
- OpenHAB::CoreExt::Java::LocalTime
 
- Includes:
- Between
- Defined in:
- lib/openhab/core_ext/java/local_time.rb
Overview
Extensions to java.time.LocalTime
Class Attribute Summary collapse
- .now ⇒ LocalTime readonly
Class Method Summary collapse
- 
  
    
      .parse(string, formatter = nil)  ⇒ LocalTime 
    
    
  
  
  
  
  
  
  
  
  
    Parses strings in the form "h[:mm[:ss]] [am/pm]" when no formatter is given. 
Instance Method Summary collapse
- #+(other) ⇒ LocalTime
- #-(other) ⇒ LocalTime
- 
  
    
      #succ  ⇒ LocalTime 
    
    
  
  
  
  
  
  
  
  
  
    Returns the next second. 
- #to_local_time ⇒ self
- #to_zoned_date_time(context = nil) ⇒ ZonedDateTime
Methods included from Between
Class Attribute Details
Class Method Details
.parse(string, formatter = nil) ⇒ LocalTime
Parses strings in the form "h[:mm[:ss]] [am/pm]" when no formatter is given.
| 55 56 57 58 59 60 61 62 63 64 65 66 67 | # File 'lib/openhab/core_ext/java/local_time.rb', line 55 def parse(string, formatter = nil) return raw_parse(string, formatter) if formatter format = /(am|pm)$/i.match?(string) ? "h[:mm[:ss][.S]][ ]a" : "H[:mm[:ss][.S]]" java_send(:parse, [java.lang.CharSequence, java.time.format.DateTimeFormatter], string, java.time.format.DateTimeFormatterBuilder.new .parse_case_insensitive .parse_lenient .append_pattern(format) .to_formatter(java.util.Locale::ENGLISH)) end | 
Instance Method Details
#+(other) ⇒ LocalTime
| 83 84 85 86 87 88 | # File 'lib/openhab/core_ext/java/local_time.rb', line 83 def +(other) return plus(other.seconds) if other.is_a?(Numeric) return self if other.is_a?(Period) plus(other) end | 
#-(other) ⇒ LocalTime
| 73 74 75 76 77 78 | # File 'lib/openhab/core_ext/java/local_time.rb', line 73 def -(other) return minus(other.seconds) if other.is_a?(Numeric) return self if other.is_a?(Period) minus(other) end | 
#succ ⇒ LocalTime
Returns the next second
Will loop back to the beginning of the day if necessary.
| 97 98 99 | # File 'lib/openhab/core_ext/java/local_time.rb', line 97 def succ plus_seconds(1) end | 
#to_local_time ⇒ self
| 102 103 104 | # File 'lib/openhab/core_ext/java/local_time.rb', line 102 def to_local_time self end | 
#to_zoned_date_time(context = nil) ⇒ ZonedDateTime
| 110 111 112 113 | # File 'lib/openhab/core_ext/java/local_time.rb', line 110 def to_zoned_date_time(context = nil) context ||= ZonedDateTime.now context.with(self) end | 
 
          