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.



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

:nodoc:



10
11
12
# File 'lib/ri_cal/required_timezones.rb', line 10

def first_time
  @first_time
end

#last_timeObject (readonly)

:nodoc:



10
11
12
# File 'lib/ri_cal/required_timezones.rb', line 10

def last_time
  @last_time
end

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

#tzidObject



16
17
18
# File 'lib/ri_cal/required_timezones.rb', line 16

def tzid
  @timezone.identifier
end