Class JCON::Types::ListType
In: lib/jcon/conformance.rb
lib/jcon/types.rb
Parent: Type

Methods

contains?   new   to_s  

Attributes

types  [R] 

Public Class methods

[Source]

    # File lib/jcon/types.rb, line 42
42:       def initialize(types); @types = Types.to_types(types); end

Public Instance methods

[Source]

    # File lib/jcon/conformance.rb, line 26
26:       def contains?(value)
27:         return false unless value.is_a?(Array)
28:         return false unless value.length >= types.length
29:         value.each_with_index do |x, i|
30:           return false unless types[[i, types.length-1].min].contains?(x)
31:         end
32:         true
33:       end

[Source]

    # File lib/jcon/types.rb, line 43
43:       def to_s; "[#{types.join(', ')}]"; end

[Validate]