Class: Typedocs::TypeSpec::Array

Inherits:
Typedocs::TypeSpec show all
Defined in:
lib/typedocs/type_spec.rb

Instance Method Summary collapse

Methods inherited from Typedocs::TypeSpec

#error_message_for

Constructor Details

#initialize(spec) ⇒ Array

Returns a new instance of Array.



120
121
122
123
# File 'lib/typedocs/type_spec.rb', line 120

def initialize(spec)
  Typedocs.ensure_klass(spec, Typedocs::TypeSpec)
  @spec = spec
end

Instance Method Details

#to_sourceObject



127
128
129
# File 'lib/typedocs/type_spec.rb', line 127

def to_source
  "#{@spec.to_source}..."
end

#valid?(obj) ⇒ Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/typedocs/type_spec.rb', line 124

def valid?(obj)
    obj.is_a?(::Array) && obj.all?{|elm| @spec.valid?(elm)}
end