Class: Parlour::Types::Tuple
Overview
A fixed-length array of items, each with a known type.
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #describe ⇒ Object
- #generate_rbi ⇒ Object
- #generate_rbs ⇒ Object
-
#initialize(types) ⇒ Tuple
constructor
A new instance of Tuple.
Methods inherited from Type
Constructor Details
#initialize(types) ⇒ Tuple
Returns a new instance of Tuple.
171 172 173 |
# File 'lib/parlour/types.rb', line 171 def initialize(types) @types = types.map(&method(:to_type)) end |
Instance Attribute Details
#types ⇒ Object (readonly)
Returns the value of attribute types.
181 182 183 |
# File 'lib/parlour/types.rb', line 181 def types @types end |
Instance Method Details
#==(other) ⇒ Object
176 177 178 |
# File 'lib/parlour/types.rb', line 176 def ==(other) Tuple === other && types == other.types end |
#describe ⇒ Object
194 195 196 |
# File 'lib/parlour/types.rb', line 194 def describe "[#{types.map(&:describe).join(', ')}]" end |
#generate_rbi ⇒ Object
184 185 186 |
# File 'lib/parlour/types.rb', line 184 def generate_rbi "[#{types.map(&:generate_rbi).join(', ')}]" end |
#generate_rbs ⇒ Object
189 190 191 |
# File 'lib/parlour/types.rb', line 189 def generate_rbs "[#{types.map(&:generate_rbs).join(', ')}]" end |