Class: JsonStructure::Array
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(elem_type = nil) ⇒ Array
constructor
A new instance of Array.
Methods inherited from Type
Constructor Details
#initialize(elem_type = nil) ⇒ Array
Returns a new instance of Array.
3 4 5 |
# File 'lib/json_structure/array.rb', line 3 def initialize(elem_type = nil) @elem_type = elem_type end |
Instance Method Details
#===(value) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/json_structure/array.rb', line 7 def ===(value) return false unless value.is_a?(::Array) if @elem_type return value.all? { |v| @elem_type === v } end true end |