class TZInfo::DataSources::TransitionsDataTimezoneInfo

def period_for(timestamp)

Experimental RBS support (using type sampling data from the type_fusion project).

def period_for: (TZInfo::Timestamp timestamp) -> untyped

This signature was generated using 30 samples from 1 application.

(see DataTimezoneInfo#period_for)
def period_for(timestamp)
  raise ArgumentError, 'timestamp must be specified' unless timestamp
  raise ArgumentError, 'timestamp must have a specified utc_offset' unless timestamp.utc_offset
  timestamp_value = timestamp.value
  index = find_minimum_transition {|t| t.timestamp_value >= timestamp_value }
  if index
    transition = @transitions[index]
    if transition.timestamp_value == timestamp_value
      # timestamp occurs within the second of the found transition, so is
      # the transition that starts the period.
      start_transition = transition
      end_transition = @transitions[index + 1]
    else
      # timestamp occurs before the second of the found transition, so is
      # the transition that ends the period.
      start_transition = index == 0 ? nil : @transitions[index - 1]
      end_transition = transition
    end
  else
    start_transition = @transitions.last
    end_transition = nil
  end
  TransitionsTimezonePeriod.new(start_transition, end_transition)
end