Class: TJSON::DataType::Float
Overview
Constant Summary
TAGS
Instance Method Summary
collapse
Methods inherited from Scalar
#inspect
[], encode, identify_type, parse
Instance Method Details
#decode(float) ⇒ Object
11
12
13
14
|
# File 'lib/tjson/datatype/float.rb', line 11
def decode(float)
raise TJSON::TypeError, "not a floating point value: #{float.inspect}" unless float.is_a?(::Numeric)
float.to_f
end
|
#encode(float) ⇒ Object
16
17
18
|
# File 'lib/tjson/datatype/float.rb', line 16
def encode(float)
float.to_f
end
|
7
8
9
|
# File 'lib/tjson/datatype/float.rb', line 7
def tag
"f"
end
|