123456789_123456789_123456789_123456789_123456789_

Class: BigDecimal

Relationships & Source Files
Inherits: Object
Defined in: ext/json/lib/json/add/bigdecimal.rb

Class Method Summary

Instance Method Summary

Class Method Details

.json_create(object)

Import a ::JSON Marshalled object.

method used for ::JSON marshalling support.

[ GitHub ]

  
# File 'ext/json/lib/json/add/bigdecimal.rb', line 11

def self.json_create(object)
  BigDecimal._load object['b']
end

Instance Method Details

#as_json

Marshal the object to ::JSON.

method used for ::JSON marshalling support.

[ GitHub ]

  
# File 'ext/json/lib/json/add/bigdecimal.rb', line 18

def as_json(*)
  {
    JSON.create_id => self.class.name,
    'b'            => _dump,
  }
end

#to_json(*args)

return the ::JSON value

[ GitHub ]

  
# File 'ext/json/lib/json/add/bigdecimal.rb', line 26

def to_json(*args)
  as_json.to_json(*args)
end