Class Index [+]

Quicksearch

Sequel::NamedTimezones

Private Instance Methods

convert_input_datetime_other(v, input_timezone) click to toggle source

Assume the given DateTime has a correct time but a wrong timezone. It is currently in UTC timezone, but it should be converted to the input_timzone. Keep the time the same but convert the timezone to the input_timezone. Expects the input_timezone to be a TZInfo::Timezone instance.

    # File lib/sequel/extensions/named_timezones.rb, line 42
42:     def convert_input_datetime_other(v, input_timezone)
43:       local_offset = input_timezone.period_for_local(v).utc_total_offset_rational
44:       (v - local_offset).new_offset(local_offset)
45:     end
convert_output_datetime_other(v, output_timezone) click to toggle source

Convert the given DateTime to use the given output_timezone. Expects the output_timezone to be a TZInfo::Timezone instance.

    # File lib/sequel/extensions/named_timezones.rb, line 49
49:     def convert_output_datetime_other(v, output_timezone)
50:       # TZInfo converts times, but expects the given DateTime to have an offset
51:       # of 0 and always leaves the timezone offset as 0
52:       v = output_timezone.utc_to_local(v.new_offset(0))
53:       local_offset = output_timezone.period_for_local(v).utc_total_offset_rational
54:       # Convert timezone offset from UTC to the offset for the output_timezone
55:       (v - local_offset).new_offset(local_offset)
56:     end
convert_timezone_setter_arg(tz) click to toggle source

Returns TZInfo::Timezone instance if given a String.

    # File lib/sequel/extensions/named_timezones.rb, line 59
59:     def convert_timezone_setter_arg(tz)
60:       tz.is_a?(String) ? TZInfo::Timezone.get(tz) : super
61:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.