| In: |
rinda/rinda.rb
|
| Parent: | Tuple |
Perform the matching of a tuple against a template. An element with a nil value in a template acts as a wildcard, matching any value in the corresponding position in the tuple.
# File rinda/rinda.rb, line 94 def match(tuple) return false unless tuple.respond_to?(:size) return false unless tuple.respond_to?(:fetch) return false unless self.size == tuple.size each do |k, v| begin it = tuple.fetch(k) rescue return false end next if v.nil? next if v == it next if v === it return false end return true end