File: array.rb

package info (click to toggle)
ruby-rr 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,424 kB
  • sloc: ruby: 11,405; makefile: 7
file content (14 lines) | stat: -rw-r--r-- 352 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Array
  def wildcard_match?(other)
    return false unless other.is_a?(Array)
    return false unless size == other.size

    each_with_index do |value, i|
      if value.respond_to?(:wildcard_match?)
        return false unless value.wildcard_match?(other[i])
      else
        return false unless value == other[i]
      end
    end
  end
end