Class: RiCal::RequiredTimezones::RequiredTimezone
- Defined in:
- lib/ri_cal/required_timezones.rb
Overview
A required timezone represents a single timezone and the earliest and latest times which reference it.
Instance Attribute Summary collapse
-
#first_time ⇒ Object
readonly
:nodoc:.
-
#last_time ⇒ Object
readonly
:nodoc:.
-
#timezone ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #add_datetime(date_time) ⇒ Object
-
#initialize(tzid) ⇒ RequiredTimezone
constructor
A new instance of RequiredTimezone.
- #tzid ⇒ Object
Constructor Details
#initialize(tzid) ⇒ RequiredTimezone
Returns a new instance of RequiredTimezone.
12 13 14 |
# File 'lib/ri_cal/required_timezones.rb', line 12 def initialize(tzid) @timezone = RiCal::Component::TZInfoTimezone.new(TZInfo::Timezone.get(tzid)) end |
Instance Attribute Details
#first_time ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/ri_cal/required_timezones.rb', line 10 def first_time @first_time end |
#last_time ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/ri_cal/required_timezones.rb', line 10 def last_time @last_time end |
#timezone ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/ri_cal/required_timezones.rb', line 10 def timezone @timezone end |
Instance Method Details
#add_datetime(date_time) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ri_cal/required_timezones.rb', line 20 def add_datetime(date_time) if @first_time @first_time = date_time if date_time < @first_time else @first_time = date_time end if @last_time @last_time = date_time if date_time > @last_time else @last_time = date_time end end |
#tzid ⇒ Object
16 17 18 |
# File 'lib/ri_cal/required_timezones.rb', line 16 def tzid @timezone.identifier end |