Class: TZInfo::Data::TZDataUntil
- Inherits:
-
Object
- Object
- TZInfo::Data::TZDataUntil
- Includes:
- TZDataParserUtils
- Defined in:
- lib/tzinfo/data/tzdataparser.rb
Overview
A tz data Zone until reference.
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(spec) ⇒ TZDataUntil
constructor
A new instance of TZDataUntil.
-
#to_utc(utc_offset, std_offset) ⇒ Object
Converts the reference to a UTC DateTime.
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
#day ⇒ Object (readonly)
Returns the value of attribute day.
1149 1150 1151 |
# File 'lib/tzinfo/data/tzdataparser.rb', line 1149 def day @day end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
1148 1149 1150 |
# File 'lib/tzinfo/data/tzdataparser.rb', line 1148 def month @month end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
1150 1151 1152 |
# File 'lib/tzinfo/data/tzdataparser.rb', line 1150 def time @time end |
#year ⇒ Object (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 |