| Class | Rinda::Tuple |
| In: |
rinda/rinda.rb
|
| Parent: | Object |
A tuple is the elementary object in Rinda programming. Tuples may be matched against templates if the tuple and the template are the same size.
Public Class methods
Public Instance methods
Accessor method for elements of the tuple.
# File rinda/rinda.rb, line 69
69: def [](k)
70: @tuple[k]
71: end
Iterate through the tuple, yielding the index or key, and the value, thus ensuring arrays are iterated similarly to hashes.
# File rinda/rinda.rb, line 84
84: def each # FIXME
85: if Hash === @tuple
86: @tuple.each { |k, v| yield(k, v) }
87: else
88: @tuple.each_with_index { |v, k| yield(k, v) }
89: end
90: end
Fetches item k from the tuple.
# File rinda/rinda.rb, line 76
76: def fetch(k)
77: @tuple.fetch(k)
78: end