Class: Gutentag::TaggedWith::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/gutentag/tagged_with/query.rb

Direct Known Subclasses

IDQuery, NameQuery

Instance Method Summary collapse

Constructor Details

#initialize(model, values, match) ⇒ Query

Returns a new instance of Query.



4
5
6
7
8
# File 'lib/gutentag/tagged_with/query.rb', line 4

def initialize(model, values, match)
  @model  = model
  @values = Array values
  @match  = match
end

Instance Method Details

#callObject



10
11
12
# File 'lib/gutentag/tagged_with/query.rb', line 10

def call
  model.where "#{model_id} #{operator} (#{query.to_sql})"
end