Module: Icalendar::Schedulable

Defined in:
lib/icalendar/schedulable-component.rb

Overview

Refines the Icalendar::Component class by adding an interface between the IceCube Gem and the the Icalendar::Component-class.

Note: Refinement is a Ruby core feature since Ruby 2.0. @see: https://ruby-doc.org/core-2.5.0/doc/syntax/refinements_rdoc.html

There are some shortcomings, the documentation says:

When using indirect method access such as Kernel#send, Kernel#method or Kernel#respond_to? refinements are not honored for the caller context during method lookup.

This behavior may be changed in the future.

The purpose of this module is:

  • normalise the handling of date and time by using ActiveSupport::TimeWithZone everywhere.
  • provide the methods start_time and end_time that always return something sensible, no matter how these times were defined in the original component.
  • provide a schedule for repeating events created by the so called rrule.

Constant Summary collapse

NULL_TIME =

The start of the Unix Epoch (January 1, 1970 00:00 UTC).

0
SEC_MIN =

the number of seconds in a minute

60
SEC_HOUR =

the number of seconds in an hour

60 * SEC_MIN
SEC_DAY =

the number of seconds in a day

24 * SEC_HOUR
SEC_WEEK =

the number of seconds in a week

7 * SEC_DAY

Instance Method Summary collapse

Instance Method Details

#end_timeActiveSupport::TimeWithZone

The time when the event or task shall end.

Returns:

  • (ActiveSupport::TimeWithZone)

    a valid DateTime object



# File 'lib/icalendar/schedulable-component.rb', line 32

#start_timeActiveSupport::TimeWithZone

The time when the event or task shall start.

Returns:

  • (ActiveSupport::TimeWithZone)

    a valid DateTime object



# File 'lib/icalendar/schedulable-component.rb', line 32