Class: TJSON::DataType::Value

Inherits:
Scalar show all
Defined in:
lib/tjson/datatype/value.rb

Overview

Boolean Value

Constant Summary

Constants inherited from TJSON::DataType

TAGS

Instance Method Summary collapse

Methods inherited from Scalar

#inspect, #scalar?

Methods inherited from TJSON::DataType

[], generate, identify_type, parse

Instance Method Details

#convert(value) ⇒ Object

Raises:



11
12
13
14
15
# File 'lib/tjson/datatype/value.rb', line 11

def convert(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

#generate(value) ⇒ Object



17
18
19
# File 'lib/tjson/datatype/value.rb', line 17

def generate(value)
  value
end

#tagObject



7
8
9
# File 'lib/tjson/datatype/value.rb', line 7

def tag
  "v"
end