Class: MongoSearch::Matchers::ExactMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo-search/matchers/exact_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(attr) ⇒ ExactMatcher

Returns a new instance of ExactMatcher.



4
5
6
# File 'lib/mongo-search/matchers/exact_matcher.rb', line 4

def initialize(attr)
  @attr = attr
end

Instance Method Details

#call(params) ⇒ Object



8
9
10
11
12
# File 'lib/mongo-search/matchers/exact_matcher.rb', line 8

def call(params)
  filters = {}
  filters[@attr] = params[@attr] if params[@attr] && !params[@attr].empty?
  filters
end