Method: TZInfo::TimeWithOffset#set_timezone_offset

Defined in:
lib/tzinfo/time_with_offset.rb

#set_timezone_offset(timezone_offset) ⇒ TimeWithOffset

Marks this TZInfo::TimeWithOffset as a local time with the UTC offset of a given TZInfo::TimezoneOffset and sets the associated TZInfo::TimezoneOffset.

Raises:

  • if timezone_offset is nil.



30
31
32
33
34
35
# File 'lib/tzinfo/time_with_offset.rb', line 30

def set_timezone_offset(timezone_offset)
  raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset
  localtime(timezone_offset.observed_utc_offset)
  @timezone_offset = timezone_offset
  self
end