Method: OpenHAB::CoreExt::Java::Time#coerce

Defined in:
lib/openhab/core_ext/java/time.rb

#coerce(other) ⇒ Array?

Convert ‘other` to this class, if possible

Returns:



53
54
55
56
57
58
59
60
# File 'lib/openhab/core_ext/java/time.rb', line 53

def coerce(other)
  logger.trace { "Coercing #{self} as a request from #{other.class}" }
  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