Module: Katello::Util::FilterClauseGenerator
- Included in:
- PackageClauseGenerator
- Defined in:
- app/lib/katello/util/filter_clause_generator.rb
Instance Method Summary collapse
-
#copy_clause ⇒ Object
This is used to generate copy clauses during the “publish” of a content view definition Generates clause in the following format => [ {$or => [<whitelist clauses>], => [{$or => [<blacklist clauses>]]} ]}.
- #generate ⇒ Object
- #initialize(repo, filters) ⇒ Object
-
#remove_clause ⇒ Object
This is used to generate unassociation clauses during the “publish” of a content view definition Generates clause in the following format { $or => [<blacklist clauses>]}}.
Instance Method Details
#copy_clause ⇒ Object
This is used to generate copy clauses during the “publish” of a content view definition Generates clause in the following format => [
{$or => [<whitelist clauses>],
=> [{$or => [<blacklist clauses>]]}
]}
21 22 23 24 25 26 27 28 29 |
# File 'app/lib/katello/util/filter_clause_generator.rb', line 21 def copy_clause clauses = [] whitelist = join_clauses(@whitelist, "$or") blacklist = !@blacklist.blank? ? {"$nor" => @blacklist} : nil clauses << whitelist if whitelist clauses << blacklist if blacklist join_clauses(clauses, "$and") end |
#generate ⇒ Object
9 10 11 12 |
# File 'app/lib/katello/util/filter_clause_generator.rb', line 9 def generate @whitelist = clauses_for(:whitelist) @blacklist = clauses_for(:blacklist) end |
#initialize(repo, filters) ⇒ Object
4 5 6 7 |
# File 'app/lib/katello/util/filter_clause_generator.rb', line 4 def initialize(repo, filters) @repo = repo @filters = filters end |
#remove_clause ⇒ Object
This is used to generate unassociation clauses during the “publish” of a content view definition Generates clause in the following format { $or => [<blacklist clauses>]}}
35 36 37 |
# File 'app/lib/katello/util/filter_clause_generator.rb', line 35 def remove_clause join_clauses(@blacklist, "$or") end |