Class: TJSON::DataType::Boolean
Overview
Constant Summary
TAGS
Instance Method Summary
collapse
Methods inherited from Scalar
#inspect
[], encode, identify_type, parse
Instance Method Details
#decode(value) ⇒ Object
11
12
13
14
15
|
# File 'lib/tjson/datatype/boolean.rb', line 11
def decode(value)
raise TJSON::TypeError, "'null' is expressly disallowed in TJSON" if value.nil?
raise TJSON::TypeError, "not a boolean value: #{value.inspect}" unless [true, false].include?(value)
value
end
|
#encode(value) ⇒ Object
17
18
19
|
# File 'lib/tjson/datatype/boolean.rb', line 17
def encode(value)
value
end
|
7
8
9
|
# File 'lib/tjson/datatype/boolean.rb', line 7
def tag
"b"
end
|