Class: TZInfo::AbsoluteDayOfYearTransitionRule

Inherits:
DayOfYearTransitionRule
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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.

Instance Method Summary collapse

Constructor Details

#initialize(day, transition_at = 0) ⇒ AbsoluteDayOfYearTransitionRule

Parameters:

  • day (Integer)

    the zero-based day of the year on which the transition occurs (0 to 365 inclusive).

  • transition_at (Integer) (defaults to: 0)

    the time in seconds after midnight local time at which the transition occurs.

Raises:

  • (ArgumentError)

    if ‘transition_at` is not an `Integer`.

  • (ArgumentError)

    if ‘day` is not an `Integer`.

  • (ArgumentError)

    if ‘day` is less than 0 or greater than 365.



130
131
132
133
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transition_rule.rb', line 130

def initialize(day, transition_at = 0)
  super(day, transition_at)
  raise ArgumentError, 'Invalid day' unless day >= 0 && day <= 365
end

Instance Method Details

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

Determines if this TZInfo::AbsoluteDayOfYearTransitionRule is equal to another instance.

Parameters:

  • r (Object)

    the instance to test for equality.

Returns:



153
154
155
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transition_rule.rb', line 153

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

#is_always_first_day_of_year?Boolean

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

Returns:

  • (Boolean)

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



137
138
139
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transition_rule.rb', line 137

def is_always_first_day_of_year?
  seconds == 0
end

#is_always_last_day_of_year?Boolean

Returns ‘false`.

Returns:

  • (Boolean)

    ‘false`.



142
143
144
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transition_rule.rb', line 142

def is_always_last_day_of_year?
  false
end