Sha256: 4922ae6a05e2f9a4e37a8906af28c22daa71f72334c28579eea584135ed7ba31

Contents?: true

Size: 1.49 KB

Versions: 109

Compression:

Stored size: 1.49 KB

Contents

require 'date'
require 'time'

class Time
  # Ruby 1.8-cvs and 1.9 define private Time#to_date
  %w(to_date to_datetime).each do |method|
    public method if private_instance_methods.include?(method)
  end

  # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
  # unmarshaled in the local zone, instead of utc. We're layering behavior on the _dump and _load
  # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
  if RUBY_VERSION < '1.9'
    class << self
      alias_method :_original_load, :_load
      def _load(marshaled_time)
        time = _original_load(marshaled_time)
        time.instance_eval do
          if defined?(@marshal_with_utc_coercion)
            val = remove_instance_variable("@marshal_with_utc_coercion")
          end
          val ? utc : self
        end
      end
    end

    alias_method :_original_dump, :_dump
    def _dump(*args)
      obj = dup
      obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
      obj._original_dump(*args)
    end
  end
end

require 'active_support/core_ext/time/behavior'
require 'active_support/core_ext/time/calculations'
require 'active_support/core_ext/time/conversions'
require 'active_support/core_ext/time/zones'

class Time#:nodoc:
  include ActiveSupport::CoreExtensions::Time::Behavior
  include ActiveSupport::CoreExtensions::Time::Calculations
  include ActiveSupport::CoreExtensions::Time::Conversions
  include ActiveSupport::CoreExtensions::Time::Zones
end

Version data entries

109 entries across 79 versions & 7 rubygems

Version Path
depengine-0.0.1 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/time.rb
depengine-0.0.1 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/time.rb
activesupport-2.3.16 lib/active_support/core_ext/time.rb
activesupport-2.3.15 lib/active_support/core_ext/time.rb
abiquo-etk-0.6.4 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.6.3 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.6.2 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.6.1 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.6.0 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.5.9 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/time.rb
abiquo-etk-0.5.8 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/activesupport-2.3.12/lib/active_support/core_ext/time.rb
activesupport-2.3.14 lib/active_support/core_ext/time.rb
kajam-1.0.3.rc2 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
activesupport-2.3.12 lib/active_support/core_ext/time.rb
radiant-1.0.0.rc2 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
radiant-1.0.0.rc1 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
abiquo-etk-0.5.3 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb
abiquo-etk-0.4.42 vendor/activesupport-2.3.8/lib/active_support/core_ext/time.rb