Class: Jsapi::JSON::Array
Overview
Represents a JSON array.
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
-
#empty? ⇒ Boolean
Returns
trueif it contains no elements,falseotherwise. -
#initialize(elements, schema, definitions) ⇒ Array
constructor
A new instance of Array.
-
#inspect ⇒ Object
:nodoc:.
-
#validate(errors) ⇒ Object
See Value#validate.
- #value ⇒ Object
Methods inherited from Value
Constructor Details
Instance Method Details
#empty? ⇒ Boolean
Returns true if it contains no elements, false otherwise.
15 16 17 |
# File 'lib/jsapi/json/array.rb', line 15 def empty? @elements.empty? end |
#inspect ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/jsapi/json/array.rb', line 19 def inspect # :nodoc: "#<#{self.class.name} [#{@elements.map(&:inspect).join(', ')}]>" end |
#validate(errors) ⇒ Object
See Value#validate.
24 25 26 27 28 |
# File 'lib/jsapi/json/array.rb', line 24 def validate(errors) return false unless super @elements.map { |element| element.validate(errors) }.all? end |
#value ⇒ Object
30 31 32 |
# File 'lib/jsapi/json/array.rb', line 30 def value @value ||= @elements.map(&:value) end |