summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Scott <zachary@zacharyscott.net>2012-11-09 02:06:34 -0500
committerZachary Scott <zachary@zacharyscott.net>2012-11-09 02:06:34 -0500
commit97d2d8deee6940e57c26ea68a884dfa1b84fcb15 (patch)
tree49631ae4946f33e92123ce258924f751eb3e070f
parent86128f517d01a3ececd640634e8f6acbda88dbc1 (diff)
downloadjson-97d2d8deee6940e57c26ea68a884dfa1b84fcb15.tar.gz
BigDecimal Documentation
-rw-r--r--lib/json/add/bigdecimal.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/json/add/bigdecimal.rb b/lib/json/add/bigdecimal.rb
index 4aafe53..0ef69f1 100644
--- a/lib/json/add/bigdecimal.rb
+++ b/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