Class: ActsAsTaggableOnMongoid::Taggable::TaggedWithQuery
- Inherits:
-
Object
- Object
- ActsAsTaggableOnMongoid::Taggable::TaggedWithQuery
- Defined in:
- lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb,
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/base.rb,
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/all_tags_query.rb,
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/any_tags_query.rb,
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/exclude_tags_query.rb,
lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/match_all_tags_query.rb
Overview
A class finding all Taggable objects for the passed in tags based on the passed in parameters. Details for how the query will work are in the TaggedWith module.
Defined Under Namespace
Classes: AllTagsQuery, AnyTagsQuery, Base, ExcludeTagsQuery, MatchAllTagsQuery
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#tag_definition ⇒ Object
readonly
Returns the value of attribute tag_definition.
-
#taggable_class ⇒ Object
readonly
Returns the value of attribute taggable_class.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(taggable_class, *tags) ⇒ TaggedWithQuery
constructor
A new instance of TaggedWithQuery.
Constructor Details
#initialize(taggable_class, *tags) ⇒ TaggedWithQuery
Returns a new instance of TaggedWithQuery.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 13 def initialize(taggable_class, *) = .dup @taggable_class = taggable_class @options = ..dup @tags = context = on_context(*[:on]) @tag_definition = taggable_class.tag_types[context] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 8 def @options end |
#tag_definition ⇒ Object (readonly)
Returns the value of attribute tag_definition.
8 9 10 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 8 def tag_definition @tag_definition end |
#taggable_class ⇒ Object (readonly)
Returns the value of attribute taggable_class.
8 9 10 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 8 def taggable_class @taggable_class end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 8 def @tags end |
Instance Method Details
#build ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query.rb', line 25 def build klass = if [:exclude].present? ExcludeTagsQuery elsif [:any].present? AnyTagsQuery elsif [:match_all] MatchAllTagsQuery else AllTagsQuery end klass.new(tag_definition, tag_list, ).build end |