Class: TZInfo::TransitionsTimezonePeriod

Inherits:
TimezonePeriod show all
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

Attributes inherited from TimezonePeriod

#offset

Instance Method Summary collapse

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.

Parameters:

  • start_transition (TimezoneTransition)

    the transition that defines the start of the period, or ‘nil` if the start is unbounded.

  • end_transition (TimezoneTransition)

    the transition that defines the end of the period, or ‘nil` if the end is unbounded.

Raises:

  • (ArgumentError)

    if both ‘start_transition` and `end_transition` are `nil`.



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_transitionTimezoneTransition (readonly)

Returns the transition that defines the end of this TZInfo::TimezonePeriod (‘nil` if the end is unbounded).

Returns:



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_transitionTimezoneTransition (readonly)

Returns the transition that defines the start of this TZInfo::TimezonePeriod (‘nil` if the start is unbounded).

Returns:



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.

Parameters:

  • p (Object)

    the instance to test for equality.

Returns:



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

#hashInteger

Returns a hash based on #start_transition and #end_transition.

Returns:



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

#inspectString

Returns the internal object state as a programmer-readable ‘String`.

Returns:

  • (String)

    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