Class: Filter::Matchers::Array

Inherits:
Base
  • Object
show all
Defined in:
lib/filter/matchers/array.rb

Instance Attribute Summary

Attributes inherited from Base

#pattern

Instance Method Summary collapse

Methods inherited from Base

#and, #or

Constructor Details

#initialize(pattern) ⇒ Array

Returns a new instance of Array.



4
5
6
# File 'lib/filter/matchers/array.rb', line 4

def initialize(pattern)
  @pattern = pattern.map(&:to_proc)
end

Instance Method Details

#===(other) ⇒ Object



8
9
10
# File 'lib/filter/matchers/array.rb', line 8

def ===(other)
  pattern.all? { |p| p === other }
end