class IceCube::Occurrence

Wraps start_time and end_time in a single concept concerning the duration. This delegates to the enclosed start_time so it behaves like a normal Time in almost all situations, however:

Without ActiveSupport, it’s necessary to cast the occurrence using to_time before doing arithmetic, else Time will try to subtract it using to_i and return a new time instead.

Time.now - Occurrence.new(start_time) # => 1970-01-01 01:00:00
Time.now - Occurrence.new(start_time).to_time # => 3600

When ActiveSupport::Time core extensions are loaded, it’s possible to subtract an Occurrence object directly from a Time to get the difference:

Time.now - Occurrence.new(start_time) # => 3600