class IDRegistry::Utils

A set of general utility methods for the implementation. Clients may also have occasion to use these methods.

Public Class Methods

matches?(pattern_, tuple_) click to toggle source

Returns true if the given pattern is matched by the given tuple.

# File lib/idregistry/utils.rb, line 50
def matches?(pattern_, tuple_)
  return false unless pattern_.size == tuple_.size
  tuple_.each_with_index do |tuple_elem_, index_|
    return false unless pattern_[index_] === tuple_elem_
  end
  return true
end