Class: TypeStruct::ArrayOf
- Includes:
- Unionable
- Defined in:
- lib/type_struct/ext.rb,
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
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
12 13 14 |
# File 'lib/type_struct/ext.rb', line 12 def to_s "#{self.class.name.split('::').last}(#{@type})" end |