Class: QueryStringSearch::MatcherFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/query_string_search/matcher_factory.rb

Class Method Summary collapse

Class Method Details

.build(search_option, build_options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/query_string_search/matcher_factory.rb', line 3

def self.build(search_option, build_options)
  matcher_to_build = build_options.detect { |m| m.build_me?(search_option) }

  if matcher_to_build
    matcher               = matcher_to_build.new
    matcher.attribute     = search_option.attribute
    matcher.desired_value = search_option.desired_value
    matcher.operator      = search_option.operator
    matcher
  end
end