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.
# File lib/rinda/rinda.rb, line 107 def init_with_ary(ary) @tuple = Array.new(ary.size) @tuple.size.times do |i| @tuple[i] = ary[i] end end
Munges ary
into a valid Tuple
.
# File lib/rinda/rinda.rb, line 117 def init_with_hash(hash) @tuple = Hash.new hash.each do |k, v| raise InvalidHashTupleKey unless String === k @tuple[k] = v end end
Ensures hash
is a valid Tuple
.
Ruby Core © 1993–2020 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.