123456789_123456789_123456789_123456789_123456789_

Class: TZInfo::AbsoluteDayOfYearTransitionRule Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: TZInfo::DayOfYearTransitionRule
Defined in: lib/tzinfo/transition_rule.rb

Overview

Defines transitions that occur on the zero-based nth day of the year.

Day 0 is 1 January.

Leap days are counted. Day 59 will be 29 February on a leap year and 1 March on a non-leap year. Day 365 will be 31 December on a leap year and 1 January the following year on a non-leap year.

Class Method Summary

DayOfYearTransitionRule - Inherited

.new

Initializes a new DayOfYearTransitionRule.

TransitionRule - Inherited

.new

Initializes a new TransitionRule.

Instance Attribute Summary

DayOfYearTransitionRule - Inherited

TransitionRule - Inherited

#transition_at

Returns the number of seconds after midnight local time on the day identified by the rule at which the transition occurs.

Instance Method Summary

DayOfYearTransitionRule - Inherited

#==

Determines if this DayOfYearTransitionRule is equal to another instance.

#eql?
#hash_args

TransitionRule - Inherited

#==

Determines if this TransitionRule is equal to another instance.

#at

Calculates the time of the transition from a given offset on a given year.

#eql?
#hash, #hash_args

Instance Attribute Details

#is_always_first_day_of_year?Boolean (readonly)

Returns:

  • (Boolean)

    true if the day specified by this transition is the first in the year (a day number of 0), otherwise false.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 137

def is_always_first_day_of_year?
  seconds == 0
end

#is_always_last_day_of_year?Boolean (readonly)

Returns:

  • (Boolean)

    false.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 142

def is_always_last_day_of_year?
  false
end

Instance Method Details

#==(r) ⇒ Boolean Also known as: #eql?

Determines if this AbsoluteDayOfYearTransitionRule is equal to another instance.

Parameters:

  • r (Object)

    the instance to test for equality.

Returns:

  • (Boolean)

    true if r is a AbsoluteDayOfYearTransitionRule with the same transition_at and day as this AbsoluteDayOfYearTransitionRule, otherwise false.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 153

def ==(r)
  super(r) && r.kind_of?(AbsoluteDayOfYearTransitionRule)
end

#eql?(r)

Alias for #==.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 156

alias eql? ==

#get_day(offset, year) ⇒ Time (protected)

Returns a Time representing midnight local time on the day specified by the rule for the given offset and year.

Parameters:

  • offset (TimezoneOffset)

    the current offset at the time of the transition.

  • year (Integer)

    the year in which the transition occurs.

Returns:

  • (Time)

    midnight local time on the day specified by the rule for the given offset and year.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 168

def get_day(offset, year)
  Time.new(year, 1, 1, 0, 0, 0, offset.observed_utc_offset) + seconds
end

#hash_argsArray (protected)

Returns:

  • (Array)

    an Array of parameters that will influence the output of hash.

[ GitHub ]

  
# File 'lib/tzinfo/transition_rule.rb', line 173

def hash_args
  [AbsoluteDayOfYearTransitionRule] + super
end