class TZInfo::TimestampWithOffset

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

# sig/tzinfo/timestamp_with_offset.rbs

class TZInfo::TimestampWithOffset < TZInfo::Timestamp
  def self.set_timezone_offset: (TZInfo::TimezoneOffset timezone_offset, TZInfo::Timestamp timestamp) -> TZInfo::TimestampWithOffset
  def set_timezone_offset: (TZInfo::TimezoneOffset timezone_offset, TZInfo::Timestamp timestamp) -> TZInfo::TimestampWithOffset
  def to_time: () -> TZInfo::TimeWithOffset
end

{TimestampWithOffset} behaves identically to {Timestamp}.
the result). Once the {TimezoneOffset} has been cleared,
{TimezoneOffset} (if the {TimezoneOffset} would not necessarily be valid for
{TimezoneOffset}. Certain operations will clear the associated
overrides various methods to return results appropriate for the
{TimestampWithOffset} holds a reference to the related {TimezoneOffset} and
A subclass of {Timestamp} used to represent local times.

def self.set_timezone_offset(timestamp, timezone_offset)

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

def self.set_timezone_offset: (TZInfo::TimezoneOffset timezone_offset, TZInfo::Timestamp timestamp) -> TZInfo::TimestampWithOffset

This signature was generated using 5 samples from 3 applications.

Raises:
  • (ArgumentError) - if `timestamp` or `timezone_offset` is `nil`.

Returns:
  • (TimestampWithOffset) - a {TimestampWithOffset} that has the same

Parameters:
  • timezone_offset (TimezoneOffset) -- a {TimezoneOffset} valid at the
  • timestamp (Timestamp) -- a {Timestamp}.
def self.set_timezone_offset(timestamp, timezone_offset)
  raise ArgumentError, 'timestamp must be specified' unless timestamp
  raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset
  new!(timestamp.value, timestamp.sub_second, timezone_offset.observed_utc_offset).set_timezone_offset(timezone_offset)
end

def set_timezone_offset(timezone_offset)

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

def set_timezone_offset: (TZInfo::TimezoneOffset timezone_offset, TZInfo::Timestamp timestamp) -> TZInfo::TimestampWithOffset

This signature was generated using 5 samples from 3 applications.

Raises:
  • (ArgumentError) - if `timezone_offset.observed_utc_offset` does not equal
  • (ArgumentError) - if {utc? self.utc?} is `true`.
  • (ArgumentError) - if `timezone_offset` is `nil`.

Returns:
  • (TimestampWithOffset) - `self`.

Parameters:
  • timezone_offset (TimezoneOffset) -- a {TimezoneOffset} valid at the time
def set_timezone_offset(timezone_offset)
  raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset
  raise ArgumentError, 'timezone_offset.observed_utc_offset does not match self.utc_offset' if utc? || utc_offset != timezone_offset.observed_utc_offset
  @timezone_offset = timezone_offset
  self
end

def to_datetime

Returns:
  • (DateTime) - if there is an associated {TimezoneOffset}, a
def to_datetime
  to = timezone_offset
  if to
    new_datetime(DateTimeWithOffset).set_timezone_offset(to)
  else
    super
  end
end

def to_time

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

def to_time: () -> TZInfo::TimeWithOffset

This signature was generated using 1 sample from 1 application.

Returns:
  • (Time) - if there is an associated {TimezoneOffset}, a
def to_time
  to = timezone_offset
  if to
    new_time(TimeWithOffset).set_timezone_offset(to)
  else
    super
  end
end