Class: Jsapi::JSON::Boolean

Inherits:
Value
  • Object
show all
Defined in:
lib/jsapi/json/boolean.rb

Overview

Represents true or false.

Constant Summary collapse

TRUTHY_VALUES =
[true, 'True', 'true'].freeze

Instance Attribute Summary collapse

Attributes inherited from Value

#schema

Instance Method Summary collapse

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

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/jsapi/json/boolean.rb', line 9

def value
  @value
end