Sha256: 4dc736f576ddefe87eff99f6ce2a060477eb556ddadd13c2600de2b1be7cf5e4

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

# frozen_string_literal: true

require_relative "conversions"
require_relative "../time/zones"

class String
  # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default
  # is set, otherwise converts String to a Time via String#to_time
  def in_time_zone(zone = ::Time.zone)
    if zone
      ::Time.find_zone!(zone).parse(self)
    else
      to_time
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activesupport/lib/active_support/core_ext/string/zones.rb