Class: SyntaxTree::Reflection::Type::ArrayType

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/reflection.rb

Overview

Represents an array type that holds another type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ ArrayType

Returns a new instance of ArrayType.



17
18
19
# File 'lib/syntax_tree/reflection.rb', line 17

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



15
16
17
# File 'lib/syntax_tree/reflection.rb', line 15

def type
  @type
end

Instance Method Details

#===(value) ⇒ Object



21
22
23
# File 'lib/syntax_tree/reflection.rb', line 21

def ===(value)
  value.is_a?(Array) && value.all? { type === _1 }
end

#inspectObject



25
26
27
# File 'lib/syntax_tree/reflection.rb', line 25

def inspect
  "Array<#{type.inspect}>"
end