Class: ActsAsTaggableOnMongoid::Taggable::TaggedWithQuery::ExcludeTagsQuery

Inherits:
Base
  • Object
show all
Defined in:
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/exclude_tags_query.rb

Overview

A class finding all Taggable objects which exclude all of the passed in tags.

Instance Attribute Summary

Attributes inherited from Base

#options, #tag_definition, #tag_list, #taggable_model

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ActsAsTaggableOnMongoid::Taggable::TaggedWithQuery::Base

Instance Method Details

#buildObject



8
9
10
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/exclude_tags_query.rb', line 8

def build
  { :id.in => included_ids }
end

#included_idsObject



12
13
14
15
16
17
18
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/exclude_tags_query.rb', line 12

def included_ids
  selector         = Origin::Selector.new
  selector[:count] = { "$gt" => 0 }

  ids = build_ids_from(selector)
  build_tagless_ids_from(selector) - ids
end