aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/lib/json/add/bigdecimal.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-12 03:05:45 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-12 03:05:45 +0000
commit062d2ee6f798205c3046730d0d348cfd0d0bc09d (patch)
tree8be6c2e72c796c481906978565bc116661e4fe9a /ext/json/lib/json/add/bigdecimal.rb
parentf1194eb9b08b7c7be39e168c1f9620e377bee472 (diff)
downloadruby-062d2ee6f798205c3046730d0d348cfd0d0bc09d.tar.gz
* ext/json: merge JSON 1.7.7.
This includes security fix. [CVE-2013-0269] https://github.com/flori/json/commit/d0a62f3ced7560daba2ad546d83f0479a5ae2cf2 https://groups.google.com/d/topic/rubyonrails-security/4_YvCpLzL58/discussion git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/lib/json/add/bigdecimal.rb')
-rw-r--r--ext/json/lib/json/add/bigdecimal.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/json/lib/json/add/bigdecimal.rb b/ext/json/lib/json/add/bigdecimal.rb
index 4aafe537ab..0ef69f12e0 100644
--- a/ext/json/lib/json/add/bigdecimal.rb
+++ b/ext/json/lib/json/add/bigdecimal.rb
@@ -4,10 +4,16 @@ end
defined?(::BigDecimal) or require 'bigdecimal'
class BigDecimal
+ # Import a JSON Marshalled object.
+ #
+ # method used for JSON marshalling support.
def self.json_create(object)
BigDecimal._load object['b']
end
+ # Marshal the object to JSON.
+ #
+ # method used for JSON marshalling support.
def as_json(*)
{
JSON.create_id => self.class.name,
@@ -15,6 +21,7 @@ class BigDecimal
}
end
+ # return the JSON value
def to_json(*)
as_json.to_json
end