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