1 # depends on: class.rb module.rb
20 "#<Tuple:0x#{object_id.to_s(16)} #{fields} elements>"
36 str << ": #{join(", ", :inspect)}"
42 def join(sep, meth=:to_s)
43 join_upto(sep, fields, meth)
46 def join_upto(sep, count, meth=:to_s)
48 return str if count == 0 or empty?
49 count = fields if count >= fields
53 str << at(i).__send__(meth)
57 str << at(count).__send__(meth)
62 return false unless Tuple === other and fields == other.fields
65 return false unless at(i) === other.at(i)
80 return self unless fields > 0
81 t = Tuple.new(fields-1)
82 t.copy_from self, 1, 0
86 # Swap elements of the two indexes.
96 t.copy_from self, 0, 0
103 alias_method :size, :fields
104 alias_method :length, :fields