module TZInfo::WithOffset

def strftime(format)

Raises:
  • (ArgumentError) - if `format` is `nil`.

Returns:
  • (String) - the formatted time.

Parameters:
  • format (String) -- the format string.
def strftime(format)
  raise ArgumentError, 'format must be specified' unless format
  if_timezone_offset do |o|
    abbreviation = nil
    format = format.gsub(/%(%*)Z/) do
      if $1.length.odd?
        # Return %%Z so the real strftime treats it as a literal %Z too.
        "#$1%Z"
      else
        "#$1#{abbreviation ||= o.abbreviation.gsub(/%/, '%%')}"
      end
    end
  end
  super
end