Class: Laser::Types::TupleType
- Inherits:
-
Base
- Object
- Base
- Laser::Types::TupleType
show all
- Defined in:
- lib/laser/types/types.rb
Overview
Represents a Tuple: an array of a given, fixed size, with each position in
the array possessing a set of constraints.
Defined Under Namespace
Classes: TupleIndexMethod, TupleMethod, TuplePlusMethod, TupleSelfMethod, TupleTimesMethod
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods inherited from Base
#==, #eql?, #hash, #|
#acts_as_struct
Constructor Details
- (TupleType) initialize(element_types)
A new instance of TupleType
236
237
238
|
# File 'lib/laser/types/types.rb', line 236
def initialize(element_types)
@element_types = element_types
end
|
Instance Attribute Details
- (Object) element_types
Returns the value of attribute element_types
235
236
237
|
# File 'lib/laser/types/types.rb', line 235
def element_types
@element_types
end
|
Instance Method Details
- (Object) [](idx)
244
245
246
|
# File 'lib/laser/types/types.rb', line 244
def [](idx)
element_types[idx]
end
|
- (Object) matching_methods(name)
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
# File 'lib/laser/types/types.rb', line 264
def matching_methods(name)
name = name.to_sym
case name
when :[]
[TupleIndexMethod.new(self)]
when :to_a, :to_ary
[TupleSelfMethod.new(self, name)]
when :+
[TuplePlusMethod.new(self)]
when :*
[TupleTimesMethod.new(self)]
else
Types::ARRAY.matching_methods(name)
end
end
|
- (Object) member_types
252
253
254
|
# File 'lib/laser/types/types.rb', line 252
def member_types
[self]
end
|
- (Object) possible_classes
248
249
250
|
# File 'lib/laser/types/types.rb', line 248
def possible_classes
::Set[Analysis::ClassRegistry['Array']]
end
|
- (Object) public_matching_methods(name)
256
257
258
259
260
261
262
|
# File 'lib/laser/types/types.rb', line 256
def public_matching_methods(name)
if ClassRegistry['Array'].visibility_for(name) == :public
matching_methods(name)
else
Types::ARRAY.public_matching_methods(name)
end
end
|
- (Object) signature
280
281
282
|
# File 'lib/laser/types/types.rb', line 280
def signature
{element_types: element_types}
end
|
- (Object) size
240
241
242
|
# File 'lib/laser/types/types.rb', line 240
def size
element_types.size
end
|