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.



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

#dayObject (readonly)

Returns the value of attribute day.



1050
1051
1052
# File 'lib/tzinfo/tzdataparser.rb', line 1050

def day
  @day
end

#monthObject (readonly)

Returns the value of attribute month.



1049
1050
1051
# File 'lib/tzinfo/tzdataparser.rb', line 1049

def month
  @month
end

#timeObject (readonly)

Returns the value of attribute time.



1051
1052
1053
# File 'lib/tzinfo/tzdataparser.rb', line 1051

def time
  @time
end

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