class TZInfo::Timestamp
def for_timestamp(timestamp, ignore_offset, target_utc_offset)
Experimental RBS support (using type sampling data from the type_fusion
project).
def for_timestamp: (TZInfo::Timestamp timestamp, bool ignore_offset, nil target_utc_offset) -> TZInfo::Timestamp
This signature was generated using 40 samples from 5 applications.
-
(Timestamp)
- a [Timestamp] representation of `timestamp`.
Parameters:
-
target_utc_offset
(Object
) -- if `ignore_offset` is `true`, the UTC -
ignore_offset
(Boolean
) -- whether to ignore the offset of -
timestamp
(Timestamp
) -- a {Timestamp}.
def for_timestamp(timestamp, ignore_offset, target_utc_offset) if ignore_offset if target_utc_offset unless target_utc_offset == :utc && timestamp.utc? || timestamp.utc_offset == target_utc_offset return new!(timestamp.value + (timestamp.utc_offset || 0), timestamp.sub_second, target_utc_offset) end elsif timestamp.utc_offset return new!(timestamp.value + timestamp.utc_offset, timestamp.sub_second) end end unless timestamp.instance_of?(Timestamp) # timestamp is identical in value, sub_second and utc_offset but is a # subclass (i.e. TimestampWithOffset). Return a new Timestamp # instance. return new!(timestamp.value, timestamp.sub_second, timestamp.utc? ? :utc : timestamp.utc_offset) end timestamp end