Class: Float
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.json_create(object) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/openc3/io/json_rpc.rb', line 90 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
98 99 100 101 102 103 104 |
# File 'lib/openc3/io/json_rpc.rb', line 98 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 |