Class: BigDecimal
- Inherits:
-
Object
- Object
- BigDecimal
- Defined in:
- lib/json/add/bigdecimal.rb
Class Method Summary collapse
-
.json_create(object) ⇒ Object
Import a JSON Marshalled object.
Instance Method Summary collapse
-
#as_json ⇒ Object
Marshal the object to JSON.
-
#to_json(*args) ⇒ Object
return the JSON value.
Class Method Details
.json_create(object) ⇒ Object
Import a JSON Marshalled object.
method used for JSON marshalling support.
11 12 13 |
# File 'lib/json/add/bigdecimal.rb', line 11 def self.json_create(object) BigDecimal._load object['b'] end |
Instance Method Details
#as_json ⇒ Object
Marshal the object to JSON.
method used for JSON marshalling support.
18 19 20 21 22 23 |
# File 'lib/json/add/bigdecimal.rb', line 18 def as_json(*) { JSON.create_id => self.class.name, 'b' => _dump, } end |
#to_json(*args) ⇒ Object
return the JSON value
26 27 28 |
# File 'lib/json/add/bigdecimal.rb', line 26 def to_json(*args) as_json.to_json(*args) end |