Class: TZInfo::DayOfMonthTransitionRule Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
TZInfo::DayOfWeekTransitionRule
|
Defined in: | lib/tzinfo/transition_rule.rb |
Overview
A rule that transitions on the nth occurrence of a particular day of week of a calendar month.
Class Method Summary
-
.new(month, week, day_of_week, transition_at = 0) ⇒ DayOfMonthTransitionRule
constructor
Internal use only
Initializes a new
DayOfMonthTransitionRule
.
DayOfWeekTransitionRule
- Inherited
.new | Initializes a new |
TransitionRule
- Inherited
.new | Initializes a new |
Instance Attribute Summary
- #offset_start ⇒ Integer readonly protected Internal use only
DayOfWeekTransitionRule
- 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
-
#==(r) ⇒ Boolean
(also: #eql?)
Internal use only
Determines if this
DayOfMonthTransitionRule
is equal to another instance. -
#eql?(r)
Alias for #==.
-
#get_day(offset, year) ⇒ Time
protected
Internal use only
Returns a
Time
representing midnight local time on the day specified by the rule for the given offset and year. - #hash_args ⇒ Array protected Internal use only
DayOfWeekTransitionRule
- Inherited
#== | Determines if this |
#eql? | Alias for DayOfWeekTransitionRule#==. |
#hash_args |
TransitionRule
- Inherited
#== | Determines if this |
#at | Calculates the time of the transition from a given offset on a given year. |
#eql? | Alias for TransitionRule#==. |
#hash, #hash_args |
Instance Attribute Details
#offset_start ⇒ Integer
(readonly, protected)
# File 'lib/tzinfo/transition_rule.rb', line 362
attr_reader :offset_start
Instance Method Details
#==(r) ⇒ Boolean
Also known as: #eql?
Determines if this DayOfMonthTransitionRule
is equal to another
instance.
# File 'lib/tzinfo/transition_rule.rb', line 353
def ==(r) super(r) && r.kind_of?(DayOfMonthTransitionRule) && @offset_start == r.offset_start end
#eql?(r)
Alias for #==.
# File 'lib/tzinfo/transition_rule.rb', line 356
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.
# File 'lib/tzinfo/transition_rule.rb', line 372
def get_day(offset, year) candidate = Time.new(year, month, @offset_start, 0, 0, 0, offset.observed_utc_offset) diff = day_of_week - candidate.wday if diff < 0 candidate + (7 + diff) * 86400 elsif diff > 0 candidate + diff * 86400 else candidate end end
#hash_args ⇒ Array
(protected)
# File 'lib/tzinfo/transition_rule.rb', line 386
def hash_args [@offset_start] + super end