Class: Float

Inherits:
Object show all
Includes:
ActiveSupport::DeprecatedNumericWithFormat, ActiveSupport::NumericWithFormat
Defined in:
activesupport/lib/active_support/core_ext/object/json.rb

Instance Method Summary collapse

Methods included from ActiveSupport::NumericWithFormat

#to_fs

Methods included from ActiveSupport::DeprecatedNumericWithFormat

#to_s

Instance Method Details

#as_json(options = nil) ⇒ Object

Encoding Infinity or NaN to JSON should return “null”. The default returns “Infinity” or “NaN” which are not valid JSON.


113
114
115
# File 'activesupport/lib/active_support/core_ext/object/json.rb', line 113

def as_json(options = nil) # :nodoc:
  finite? ? self : nil
end