Sha256: 2f22fc9b902520bcd4570efa57731e74b729589b167cf1256152d105720daefe

Contents?: true

Size: 405 Bytes

Versions: 154

Compression:

Stored size: 405 Bytes

Contents

require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/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

154 entries across 146 versions & 17 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.7.1/lib/active_support/core_ext/string/zones.rb
activesupport-4.2.11.3 lib/active_support/core_ext/string/zones.rb
activesupport-4.2.11.2 lib/active_support/core_ext/string/zones.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/string/zones.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/string/zones.rb
activesupport-5.0.7.2 lib/active_support/core_ext/string/zones.rb
activesupport-4.2.11.1 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.7.1 lib/active_support/core_ext/string/zones.rb
activesupport-4.2.11 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.7 lib/active_support/core_ext/string/zones.rb
activesupport-4.2.10 lib/active_support/core_ext/string/zones.rb
activesupport-4.2.10.rc1 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.6 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.6.rc1 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.5 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.5.rc2 lib/active_support/core_ext/string/zones.rb
activesupport-5.0.5.rc1 lib/active_support/core_ext/string/zones.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/string/zones.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/string/zones.rb
activesupport-4.2.9 lib/active_support/core_ext/string/zones.rb