Class: SyntaxTree::Reflection::Type::ArrayType
- Inherits:
-
Object
- Object
- SyntaxTree::Reflection::Type::ArrayType
- Defined in:
- lib/syntax_tree/reflection.rb
Overview
Represents an array type that holds another type.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(type) ⇒ ArrayType
constructor
A new instance of ArrayType.
- #inspect ⇒ Object
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
#type ⇒ Object (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 |
#inspect ⇒ Object
25 26 27 |
# File 'lib/syntax_tree/reflection.rb', line 25 def inspect "Array<#{type.inspect}>" end |