Sha256: d1a04b2f23d846434ff776cea25bf84ff9bc66ea5c6ab6ea69e7dbc9ba996d8a

Contents?: true

Size: 1.42 KB

Versions: 75

Compression:

Stored size: 1.42 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)
        utc = time.instance_variable_get('@marshal_with_utc_coercion')
        utc ? time.utc : time
      end
    end
    
    alias_method :_original_dump, :_dump
    def _dump(*args)
      obj = self.frozen? ? self.dup : self
      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

75 entries across 72 versions & 18 rubygems

Version Path
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.2.2/lib/active_support/core_ext/time.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.3.3/lib/active_support/core_ext/time.rb
activesupport-2.3.6.pre lib/active_support/core_ext/time.rb
simply_stated-0.0.5 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/time.rb
simply_stated-0.0.4 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/time.rb
factorylabs-castronaut-0.7.5 vendor/activesupport/lib/active_support/core_ext/time.rb
ginst-2009.12.8 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
activesupport-2.3.5 lib/active_support/core_ext/time.rb
ginst-2009.11.24 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
ginst-2009.11.23 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
ginst-2.0.1 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
ginst-2.0.0 vendor/rails/activesupport/lib/active_support/core_ext/time.rb
gemstreamer-1.2.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
gemstreamer-1.1.1 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
gemstreamer-1.1.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
gemstreamer-1.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
gemstreamer-0.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/time.rb
radiant-rc-0.9.0 vendor/rails/activesupport/lib/active_support/core_ext/time.rb