module Kernel
Public Instance Methods
Timerage(time_or_time_interval_ish)
click to toggle source
# File lib/timerage.rb, line 35 def Timerage(time_or_time_interval_ish) thing = time_or_time_interval_ish case thing when ->(x) { x.respond_to? :to_time_interval } thing when ->(x) { x.respond_to? :exclude_end? } Timerage::TimeInterval.new(thing) when ->(x) { x.respond_to? :to_str } Timerage.parse_iso8601(thing.to_str) when ->(x) { x.respond_to? :to_time } thing.to_time else fail TypeError, "unable to coerce #{thing} to a time or interval" end end