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.
14 15 16 |
# File 'lib/ri_cal/required_timezones.rb', line 14 def initialize(tzid) @timezone = RiCal::Component::TZInfoTimezone.new(TZInfo::Timezone.get(tzid)) end |
Instance Attribute Details
#first_time ⇒ Object (readonly)
:nodoc:
12 13 14 |
# File 'lib/ri_cal/required_timezones.rb', line 12 def first_time @first_time end |
#last_time ⇒ Object (readonly)
:nodoc:
12 13 14 |
# File 'lib/ri_cal/required_timezones.rb', line 12 def last_time @last_time end |
#timezone ⇒ Object (readonly)
:nodoc:
12 13 14 |
# File 'lib/ri_cal/required_timezones.rb', line 12 def timezone @timezone end |
Instance Method Details
#add_datetime(date_time) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ri_cal/required_timezones.rb', line 22 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
18 19 20 |
# File 'lib/ri_cal/required_timezones.rb', line 18 def tzid @timezone.identifier end |