summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2012-11-12 09:17:02 -0800
committerFlorian Frank <flori@ping.de>2012-11-12 09:17:02 -0800
commite3c6a7c7fee695b45b9cd2bf062138bcc54b2d28 (patch)
tree49631ae4946f33e92123ce258924f751eb3e070f
parent86128f517d01a3ececd640634e8f6acbda88dbc1 (diff)
parent97d2d8deee6940e57c26ea68a884dfa1b84fcb15 (diff)
downloadjson-e3c6a7c7fee695b45b9cd2bf062138bcc54b2d28.tar.gz
Merge pull request #150 from zzak/master
BigDecimal Documentation, Thx zzak.
-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