Class: Metka::QueryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/metka/query_builder.rb

Instance Method Summary collapse

Instance Method Details

#call(taggable_model, column, tag_list, options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/metka/query_builder.rb', line 11

def call(taggable_model, column, tag_list, options)
  if options[:exclude_all].present?
    ExcludeAllTagsQuery.instance.call(taggable_model, column, tag_list)
  elsif options[:exclude_any].present?
    ExcludeAnyTagsQuery.instance.call(taggable_model, column, tag_list)
  elsif options[:any].present?
    AnyTagsQuery.instance.call(taggable_model, column, tag_list)
  else
    AllTagsQuery.instance.call(taggable_model, column, tag_list)
  end
end