Class: TZInfo::TZDataUntil
- Inherits:
-
Object
- Object
- TZInfo::TZDataUntil
- Defined in:
- lib/tzinfo/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
:nodoc:.
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.
1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/tzinfo/tzdataparser.rb', line 1053 def initialize(spec) parts = spec.split(/\s+/) raise "Invalid until: #{spec}" if parts.length < 1 @year = parts[0].to_i @month = parts.length > 1 ? TZDataParser.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.
1050 1051 1052 |
# File 'lib/tzinfo/tzdataparser.rb', line 1050 def day @day end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
1049 1050 1051 |
# File 'lib/tzinfo/tzdataparser.rb', line 1049 def month @month end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
1051 1052 1053 |
# File 'lib/tzinfo/tzdataparser.rb', line 1051 def time @time end |
#year ⇒ Object (readonly)
:nodoc:
1048 1049 1050 |
# File 'lib/tzinfo/tzdataparser.rb', line 1048 def year @year end |
Instance Method Details
#to_utc(utc_offset, std_offset) ⇒ Object
Converts the reference to a UTC DateTime.
1064 1065 1066 |
# File 'lib/tzinfo/tzdataparser.rb', line 1064 def to_utc(utc_offset, std_offset) @time.to_utc(utc_offset, std_offset, @year, @month, @day.to_absolute(@year, @month)) end |