Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rinda/rinda.rb



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

new(ary_or_hash) click to toggle source

Creates a new Tuple from ary_or_hash which must be an Array or Hash.

               # File rinda/rinda.rb, line 51
def initialize(ary_or_hash)
  if hash?(ary_or_hash)

Public Instance Methods

[](k) click to toggle source

Accessor method for elements of the tuple.

               # File rinda/rinda.rb, line 69
def [](k)
each() click to toggle source

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
def each # FIXME
  if Hash === @tuple
    @tuple.each { |k, v| yield(k, v) }
    @tuple.each_with_index { |v, k| yield(k, v) }
fetch(k) click to toggle source

Fetches item k from the tuple.

               # File rinda/rinda.rb, line 76
def fetch(k)
size() click to toggle source

The number of elements in the tuple.

               # File rinda/rinda.rb, line 62
def size
value() click to toggle source

Return the tuple itself

               # File rinda/rinda.rb, line 94
def value

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.