Class: TZInfo::Data::TZDataUntil

Inherits:
Object
  • Object
show all
Includes:
TZDataParserUtils
Defined in:
lib/tzinfo/data/tzdataparser.rb

Overview

A tz data Zone until reference.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ TZDataUntil

Returns a new instance of TZDataUntil.



1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/tzinfo/data/tzdataparser.rb', line 1152

def initialize(spec)      
  parts = spec.split(/\s+/)      
  raise "Invalid until: #{spec}" if parts.length < 1
  
  @year = parts[0].to_i
  @month = parts.length > 1 ? parse_month(parts[1]) : 1
  @day = TZDataDayOfMonth.new(parts.length > 2 ? parts[2] : '1')
  @time = TZDataTime.new(parts.length > 3 ? parts[3] : '00:00')
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



1149
1150
1151
# File 'lib/tzinfo/data/tzdataparser.rb', line 1149

def day
  @day
end

#monthObject (readonly)

Returns the value of attribute month.



1148
1149
1150
# File 'lib/tzinfo/data/tzdataparser.rb', line 1148

def month
  @month
end

#timeObject (readonly)

Returns the value of attribute time.



1150
1151
1152
# File 'lib/tzinfo/data/tzdataparser.rb', line 1150

def time
  @time
end

#yearObject (readonly)

Returns the value of attribute year.



1147
1148
1149
# File 'lib/tzinfo/data/tzdataparser.rb', line 1147

def year
  @year
end

Instance Method Details

#to_utc(utc_offset, std_offset) ⇒ Object

Converts the reference to a UTC DateTime.



1163
1164
1165
# File 'lib/tzinfo/data/tzdataparser.rb', line 1163

def to_utc(utc_offset, std_offset)
  @time.to_utc(utc_offset, std_offset, @year, @month, @day.to_absolute(@year, @month))            
end