Class: ActsAsTaggableOnMongoid::Taggable::TaggedWithQuery::MatchAllTagsQuery

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

Overview

A class finding all Taggable objects which include all and only 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/match_all_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/match_all_tags_query.rb', line 12

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

  AllTagsQuery.new(tag_definition, tag_list, options).included_ids -
      build_tagless_ids_from(selector)
end