Class: MongoSearch::Matchers::IntersectMatcher
- Inherits:
-
Object
- Object
- MongoSearch::Matchers::IntersectMatcher
- Defined in:
- lib/mongo-search/matchers/intersect_matcher.rb
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(attr) ⇒ IntersectMatcher
constructor
A new instance of IntersectMatcher.
Constructor Details
#initialize(attr) ⇒ IntersectMatcher
Returns a new instance of IntersectMatcher.
4 5 6 |
# File 'lib/mongo-search/matchers/intersect_matcher.rb', line 4 def initialize(attr) @attr = attr end |
Instance Method Details
#call(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mongo-search/matchers/intersect_matcher.rb', line 8 def call(params) filters = {} if params[@attr] && !params[@attr].empty? value = params[@attr] filters[@attr] = {:$all => Converters[:array].call(value)} end filters end |