Class: OpenHAB::CoreExt::Java::Period
- Inherits:
-
Object
- Object
- OpenHAB::CoreExt::Java::Period
- Includes:
- TemporalAmount
- Defined in:
- lib/openhab/core_ext/java/period.rb
Overview
Extensions to javajava.timejava.time.Period
Instance Method Summary collapse
- #<=>(other) ⇒ Integer?
-
#coerce(other) ⇒ Array?
Convert ‘self` and `other` to Duration, if `other` is a Numeric.
-
#to_f ⇒ Float
Convert to number of seconds.
-
#to_i ⇒ Integer
Convert to number of seconds.
Methods included from TemporalAmount
#-@, #ago, #from_now, #inspect
Instance Method Details
#<=>(other) ⇒ Integer?
37 38 39 40 41 |
# File 'lib/openhab/core_ext/java/period.rb', line 37 def <=>(other) return to_i <=> other if other.is_a?(Numeric) super end |
#coerce(other) ⇒ Array?
Convert ‘self` and `other` to Duration, if `other` is a Numeric
49 50 51 |
# File 'lib/openhab/core_ext/java/period.rb', line 49 def coerce(other) [other.seconds, to_i.seconds] if other.is_a?(Numeric) end |
#to_f ⇒ Float
Convert to number of seconds
30 31 32 |
# File 'lib/openhab/core_ext/java/period.rb', line 30 def to_f to_i.to_f end |