Class: ForemanTasks::CompositeActionRule
- Inherits:
-
Object
- Object
- ForemanTasks::CompositeActionRule
- Defined in:
- lib/foreman_tasks/cleaner.rb
Instance Method Summary collapse
- #exclude_search ⇒ Object
-
#initialize(*rules) ⇒ CompositeActionRule
constructor
A new instance of CompositeActionRule.
Constructor Details
#initialize(*rules) ⇒ CompositeActionRule
Returns a new instance of CompositeActionRule.
36 37 38 |
# File 'lib/foreman_tasks/cleaner.rb', line 36 def initialize(*rules) @rules = rules end |
Instance Method Details
#exclude_search ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/foreman_tasks/cleaner.rb', line 40 def exclude_search partial_condition = @rules.group_by(&:condition) .map do |condition, rules| ActionRule.new(rules.map(&:klass), nil, condition).include_search end.join(' OR ') "NOT (#{partial_condition})" end |