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.
1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'lib/tzinfo/tzdataparser.rb', line 1060 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.
1057 1058 1059 |
# File 'lib/tzinfo/tzdataparser.rb', line 1057 def day @day end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
1056 1057 1058 |
# File 'lib/tzinfo/tzdataparser.rb', line 1056 def month @month end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
1058 1059 1060 |
# File 'lib/tzinfo/tzdataparser.rb', line 1058 def time @time end |
#year ⇒ Object (readonly)
:nodoc:
1055 1056 1057 |
# File 'lib/tzinfo/tzdataparser.rb', line 1055 def year @year end |
Instance Method Details
#to_utc(utc_offset, std_offset) ⇒ Object
Converts the reference to a UTC DateTime.
1071 1072 1073 |
# File 'lib/tzinfo/tzdataparser.rb', line 1071 def to_utc(utc_offset, std_offset) @time.to_utc(utc_offset, std_offset, @year, @month, @day.to_absolute(@year, @month)) end |