Class: TZInfo::TransitionsTimezonePeriod
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
TimezonePeriod
|
|
Instance Chain:
self,
TimezonePeriod
|
|
Inherits: |
TZInfo::TimezonePeriod
|
Defined in: | lib/tzinfo/transitions_timezone_period.rb |
Overview
Represents a period of time in a time zone where the same offset from UTC applies. The period of time is bounded at at least one end, either having a start transition, end transition or both start and end transitions.
Class Method Summary
-
.new(start_transition, end_transition) ⇒ TransitionsTimezonePeriod
constructor
Initializes a
TransitionsTimezonePeriod
.
TimezonePeriod
- Inherited
.new | Initializes a |
Instance Attribute Summary
- #end_transition ⇒ TimezoneTransition readonly
- #start_transition ⇒ TimezoneTransition readonly
TimezonePeriod
- Inherited
Instance Method Summary
-
#==(p) ⇒ Boolean
(also: #eql?)
Determines if this
TransitionsTimezonePeriod
is equal to another instance. -
#eql?(p)
Alias for #==.
- #hash ⇒ Integer
- #inspect ⇒ String
TimezonePeriod
- Inherited
#abbr | Alias for TimezonePeriod#abbreviation. |
#abbreviation | The abbreviation that identifies this offset. |
#base_utc_offset | Returns the base offset from UTC in seconds ( |
#end_transition, | |
#ends_at | Returns the UTC end time of the period or |
#local_ends_at | Returns the local end time of the period or |
#local_starts_at | Returns the local start time of the period or |
#observed_utc_offset | Returns the observed offset from UTC in seconds ( |
#start_transition, | |
#starts_at | Returns the UTC start time of the period or |
#std_offset | Returns the offset from the time zone's standard time in seconds ( |
#utc_offset | Alias for TimezonePeriod#base_utc_offset. |
#utc_total_offset | Alias for TimezonePeriod#observed_utc_offset. |
#zone_identifier | Alias for TimezonePeriod#abbreviation. |
#raise_not_implemented | Raises a |
#timestamp, #timestamp_with_offset |
Constructor Details
.new(start_transition, end_transition) ⇒ TransitionsTimezonePeriod
Initializes a TransitionsTimezonePeriod
.
At least one of #start_transition and #end_transition must be specified.
# File 'lib/tzinfo/transitions_timezone_period.rb', line 27
def initialize(start_transition, end_transition) if start_transition super(start_transition.offset) elsif end_transition super(end_transition.previous_offset) else raise ArgumentError, 'At least one of start_transition and end_transition must be specified' end @start_transition = start_transition @end_transition = end_transition end
Instance Attribute Details
#end_transition ⇒ TimezoneTransition (readonly)
# File 'lib/tzinfo/transitions_timezone_period.rb', line 15
attr_reader :end_transition
#start_transition ⇒ TimezoneTransition (readonly)
# File 'lib/tzinfo/transitions_timezone_period.rb', line 11
attr_reader :start_transition
Instance Method Details
#==(p) ⇒ Boolean
Also known as: #eql?
Determines if this TransitionsTimezonePeriod
is equal to another
instance.
# File 'lib/tzinfo/transitions_timezone_period.rb', line 47
def ==(p) p.kind_of?(TransitionsTimezonePeriod) && start_transition == p.start_transition && end_transition == p.end_transition end
#eql?(p)
Alias for #==.
# File 'lib/tzinfo/transitions_timezone_period.rb', line 50
alias eql? ==
#hash ⇒ Integer
# File 'lib/tzinfo/transitions_timezone_period.rb', line 53
def hash [@start_transition, @end_transition].hash end
#inspect ⇒ String
# File 'lib/tzinfo/transitions_timezone_period.rb', line 59
def inspect "#<#{self.class}: @start_transition=#{@start_transition.inspect}, @end_transition=#{@end_transition.inspect}>" end