Class: TypeStruct::ArrayOf
- Inherits:
-
Object
- Object
- TypeStruct::ArrayOf
- Includes:
- Unionable
- Defined in:
- lib/type_struct/array_of.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(type) ⇒ ArrayOf
constructor
A new instance of ArrayOf.
- #to_s ⇒ Object (also: #inspect)
Methods included from Unionable
Constructor Details
#initialize(type) ⇒ ArrayOf
Returns a new instance of ArrayOf.
7 8 9 |
# File 'lib/type_struct/array_of.rb', line 7 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/type_struct/array_of.rb', line 6 def type @type end |
Instance Method Details
#===(other) ⇒ Object
16 17 18 19 |
# File 'lib/type_struct/array_of.rb', line 16 def ===(other) return false unless Array === other other.all? { |o| @type === o } end |
#to_s ⇒ Object Also known as: inspect
11 12 13 |
# File 'lib/type_struct/array_of.rb', line 11 def to_s "#{self.class}(#{@type})" end |