class TZInfo::TZDataTransition
:nodoc:
@private
A transition that will be used to write the periods in a zone class.
def <=>(transition)
def <=>(transition) if @at_utc == transition.at_utc 0 elsif @at_utc.nil? -1 elsif transition.nil? 1 else @at_utc - transition.at_utc end end
def clone_with_at(at_utc)
def clone_with_at(at_utc) TZDataTransition.new(at_utc, @utc_offset, @std_offset, @zone_id) end
def datetime_constructor(datetime)
def datetime_constructor(datetime) if (1970..2037).include?(datetime.year) "#{Time.utc(datetime.year, datetime.mon, datetime.mday, datetime.hour, datetime.min, datetime.sec).to_i}" else "#{datetime.ajd.numerator}, #{datetime.ajd.denominator}" end end
def initialize(at_utc, utc_offset, std_offset, zone_id)
def initialize(at_utc, utc_offset, std_offset, zone_id) @at_utc = at_utc @utc_offset = utc_offset @std_offset = std_offset @zone_id = zone_id @offset_name = nil end
def to_s
def to_s "At #{at_utc} UTC switch to UTC offset #{@utc_offset} with std offset #{@std_offset}, zone id #{@zone_id}" end
def total_offset
def total_offset @utc_offset + @std_offset end
def write(file)
def write(file) if @at_utc file.puts "tz.transition #{@at_utc.year}, #{@at_utc.mon}, :#{@offset_name}, #{datetime_constructor(@at_utc)}" end end