Class: RiCal::RequiredTimezones::RequiredTimezone

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_timeObject (readonly)

:nodoc:



12
13
14
# File 'lib/ri_cal/required_timezones.rb', line 12

def first_time
  @first_time
end

#last_timeObject (readonly)

:nodoc:



12
13
14
# File 'lib/ri_cal/required_timezones.rb', line 12

def last_time
  @last_time
end

#timezoneObject (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

#tzidObject



18
19
20
# File 'lib/ri_cal/required_timezones.rb', line 18

def tzid
  @timezone.identifier
end