class Gutentag::TaggedWith

Attributes

model[R]
options[R]

Public Class Methods

call(model, options) click to toggle source
# File lib/gutentag/tagged_with.rb, line 4
def self.call(model, options)
  new(model, options).call
end
new(model, options) click to toggle source
# File lib/gutentag/tagged_with.rb, line 8
def initialize(model, options)
  @model   = model
  @options = options
end

Public Instance Methods

call() click to toggle source
# File lib/gutentag/tagged_with.rb, line 13
def call
  query_class.new(model, values, match).call
end

Private Instance Methods

match() click to toggle source
# File lib/gutentag/tagged_with.rb, line 21
def match
  options[:match] || :any
end
query_class() click to toggle source
# File lib/gutentag/tagged_with.rb, line 25
def query_class
  options[:names] ? NameQuery : IDQuery
end
values() click to toggle source
# File lib/gutentag/tagged_with.rb, line 29
def values
  if options[:tags]
    Array(options[:tags]).collect(&:id)
  else
    options[:ids] || options[:names]
  end
end