Class: TZInfo::TZDataUntil

Inherits:
Object
  • Object
show all
Defined in:
lib/tzinfo/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.



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

#dayObject (readonly)

Returns the value of attribute day.



1057
1058
1059
# File 'lib/tzinfo/tzdataparser.rb', line 1057

def day
  @day
end

#monthObject (readonly)

Returns the value of attribute month.



1056
1057
1058
# File 'lib/tzinfo/tzdataparser.rb', line 1056

def month
  @month
end

#timeObject (readonly)

Returns the value of attribute time.



1058
1059
1060
# File 'lib/tzinfo/tzdataparser.rb', line 1058

def time
  @time
end

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