Class: TZInfo::TransitionsTimezonePeriod
- Inherits:
-
TimezonePeriod
- Object
- TimezonePeriod
- TZInfo::TransitionsTimezonePeriod
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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.
Instance Attribute Summary collapse
-
#end_transition ⇒ TimezoneTransition
readonly
The transition that defines the end of this TimezonePeriod (‘nil` if the end is unbounded).
-
#start_transition ⇒ TimezoneTransition
readonly
The transition that defines the start of this TimezonePeriod (‘nil` if the start is unbounded).
Attributes inherited from TimezonePeriod
Instance Method Summary collapse
-
#==(p) ⇒ Boolean
(also: #eql?)
Determines if this TransitionsTimezonePeriod is equal to another instance.
-
#hash ⇒ Integer
A hash based on #start_transition and #end_transition.
-
#initialize(start_transition, end_transition) ⇒ TransitionsTimezonePeriod
constructor
Initializes a TransitionsTimezonePeriod.
-
#inspect ⇒ String
The internal object state as a programmer-readable ‘String`.
Methods inherited from TimezonePeriod
#abbreviation, #base_utc_offset, #dst?, #ends_at, #local_ends_at, #local_starts_at, #observed_utc_offset, #starts_at, #std_offset
Constructor Details
#initialize(start_transition, end_transition) ⇒ TransitionsTimezonePeriod
Initializes a TZInfo::TransitionsTimezonePeriod.
At least one of ‘start_transition` and `end_transition` must be specified.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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)
Returns the transition that defines the end of this TZInfo::TimezonePeriod (‘nil` if the end is unbounded).
15 16 17 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transitions_timezone_period.rb', line 15 def end_transition @end_transition end |
#start_transition ⇒ TimezoneTransition (readonly)
Returns the transition that defines the start of this TZInfo::TimezonePeriod (‘nil` if the start is unbounded).
11 12 13 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transitions_timezone_period.rb', line 11 def start_transition @start_transition end |
Instance Method Details
#==(p) ⇒ Boolean Also known as: eql?
Determines if this TZInfo::TransitionsTimezonePeriod is equal to another instance.
47 48 49 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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 |
#hash ⇒ Integer
Returns a hash based on #start_transition and #end_transition.
53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transitions_timezone_period.rb', line 53 def hash [@start_transition, @end_transition].hash end |
#inspect ⇒ String
Returns the internal object state as a programmer-readable ‘String`.
59 60 61 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/transitions_timezone_period.rb', line 59 def inspect "#<#{self.class}: @start_transition=#{@start_transition.inspect}, @end_transition=#{@end_transition.inspect}>" end |