Class: TypeStruct::ArrayOf
- Inherits:
-
Object
- Object
- TypeStruct::ArrayOf
- Defined in:
- lib/type_struct/arrayof.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)
- #|(other) ⇒ Object
Constructor Details
#initialize(type) ⇒ ArrayOf
Returns a new instance of ArrayOf.
6 7 8 |
# File 'lib/type_struct/arrayof.rb', line 6 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/type_struct/arrayof.rb', line 5 def type @type end |
Instance Method Details
#===(other) ⇒ Object
19 20 21 22 |
# File 'lib/type_struct/arrayof.rb', line 19 def ===(other) return false unless other.respond_to?(:any?) other.any? { |o| @type === o } end |
#to_s ⇒ Object Also known as: inspect
14 15 16 |
# File 'lib/type_struct/arrayof.rb', line 14 def to_s "#<#{self.class} #{@type}>" end |