Method: DateTime#coerce

Defined in:
lib/openhab/core_ext/ruby/date_time.rb

#coerce(other) ⇒ Array?

Converts to a ZonedDateTime if ‘other` is also convertible to a ZonedDateTime.

Parameters:

Returns:



54
55
56
57
58
59
60
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 54

def coerce(other)
  logger.trace { "Coercing #{self} as a request from #{other.class}" }
  return unless other.respond_to?(:to_zoned_date_time)

  zdt = to_zoned_date_time
  [other.to_zoned_date_time(zdt), zdt]
end