diff options
-rw-r--r-- | activesupport/lib/active_support/core_ext/marshal.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/json.rb | 20 |
2 files changed, 10 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/core_ext/marshal.rb b/activesupport/lib/active_support/core_ext/marshal.rb index 97e65e89d3..20a0856e71 100644 --- a/activesupport/lib/active_support/core_ext/marshal.rb +++ b/activesupport/lib/active_support/core_ext/marshal.rb @@ -1,5 +1,5 @@ module ActiveSupport - module MarshalWithAutoloading + module MarshalWithAutoloading # :nodoc: def load(source) super(source) rescue ArgumentError, NameError => exc diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index 09349bd85a..0db787010c 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -27,23 +27,21 @@ require 'active_support/core_ext/date/conversions' # should give exactly the same results with or without active support. module ActiveSupport - module CoreExt - module ToJsonWithActiveSupportEncoder - def to_json(options = nil) - if options.is_a?(::JSON::State) - # Called from JSON.{generate,dump}, forward it to JSON gem's to_json - super(options) - else - # to_json is being invoked directly, use ActiveSupport's encoder - ActiveSupport::JSON.encode(self, options) - end + module ToJsonWithActiveSupportEncoder # :nodoc: + def to_json(options = nil) + if options.is_a?(::JSON::State) + # Called from JSON.{generate,dump}, forward it to JSON gem's to_json + super(options) + else + # to_json is being invoked directly, use ActiveSupport's encoder + ActiveSupport::JSON.encode(self, options) end end end end [Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass| - klass.prepend(ActiveSupport::CoreExt::ToJsonWithActiveSupportEncoder) + klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder) end class Object |