Class: Float
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.json_create(object) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/cosmos/io/json_rpc.rb', line 65 def self.json_create(object) case object['raw'] when "Infinity" then Float::INFINITY when "-Infinity" then -Float::INFINITY when "NaN" then Float::NAN end end |
Instance Method Details
#as_json(options = nil) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/cosmos/io/json_rpc.rb', line 73 def as_json( = nil) return {"json_class"=>Float, "raw"=>"Infinity"} if self.infinite? == 1 return {"json_class"=>Float, "raw"=>"-Infinity"} if self.infinite? == -1 return {"json_class"=>Float, "raw"=>"NaN"} if self.nan? return self end |