Class: Jsapi::JSON::Boolean
Overview
Represents true
or false
.
Constant Summary collapse
- TRUTHY_VALUES =
[true, 'True', 'true'].freeze
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Value
Instance Method Summary collapse
-
#initialize(value, schema) ⇒ Boolean
constructor
A new instance of Boolean.
Methods inherited from Value
#empty?, #inspect, #null?, #validate
Constructor Details
#initialize(value, schema) ⇒ Boolean
Returns a new instance of Boolean.
11 12 13 14 |
# File 'lib/jsapi/json/boolean.rb', line 11 def initialize(value, schema) super(schema) @value = value.in?(TRUTHY_VALUES) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/jsapi/json/boolean.rb', line 9 def value @value end |