From 97d2d8deee6940e57c26ea68a884dfa1b84fcb15 Mon Sep 17 00:00:00 2001 From: Zachary Scott Date: Fri, 9 Nov 2012 02:06:34 -0500 Subject: BigDecimal Documentation --- lib/json/add/bigdecimal.rb | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.1