Sha256: 0bf2cfd1a177d65d408569bf727bd79aed19acf6b04a6e8a8642db3f691452c4

Contents?: true

Size: 568 Bytes

Versions: 279

Compression:

Stored size: 568 Bytes

Contents

unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
  require 'json'
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,
      'b'            => _dump,
    }
  end

  # return the JSON value
  def to_json(*)
    as_json.to_json
  end
end

Version data entries

279 entries across 241 versions & 47 rubygems

Version Path
savant-echo-0.1.5 bin/alexa-0.1.2-osx/lib/ruby/lib/ruby/2.2.0/json/add/bigdecimal.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/ruby/lib/ruby/2.2.0/json/add/bigdecimal.rb
savant-echo-0.1.3 bin/alexa-0.1.2-osx/lib/ruby/lib/ruby/2.2.0/json/add/bigdecimal.rb
engineyard-serverside-2.6.11 lib/vendor/json_pure/lib/json/add/bigdecimal.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/second_step-0.1.1/secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/2.2.0/json/add/bigdecimal.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/2.2.0/json/add/bigdecimal.rb
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/json-1.8.3/lib/json/add/bigdecimal.rb
rb2exe-0.1.60 bin/traveling-ruby-2.2.2/osx/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.60 bin/traveling-ruby-2.2.2/l32/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.60 bin/traveling-ruby-2.2.2/win/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.60 bin/traveling-ruby-2.2.2/l64/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.58 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.57 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.56 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.55 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.54 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.53 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.52 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.51 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb
rb2exe-0.1.50 bin/traveling-ruby-2.2.2/lib/ruby/2.2.0/json/add/bigdecimal.rb