aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/json.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-20 18:11:24 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-20 18:11:24 -0300
commit7c7d9dcf5a966a5490fe99230ab9513d73df9630 (patch)
treec9ccc156d31fd802e276c3983b32f29b8d22dfb0 /activesupport/lib/active_support/core_ext/object/json.rb
parentc35ebe17d8b8f3c045dd0e178aedd294aa21edc2 (diff)
downloadrails-7c7d9dcf5a966a5490fe99230ab9513d73df9630.tar.gz
rails-7c7d9dcf5a966a5490fe99230ab9513d73df9630.tar.bz2
rails-7c7d9dcf5a966a5490fe99230ab9513d73df9630.zip
Mark some constants as nodoc and remove unneeded namespace
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/json.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object/json.rb20
1 files changed, 9 insertions, 11 deletions
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