Class: Querly::Check::Query
- Inherits:
-
Struct
- Object
- Struct
- Querly::Check::Query
- Defined in:
- lib/querly/check.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#opr ⇒ Object
Returns the value of attribute opr.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier
3 4 5 |
# File 'lib/querly/check.rb', line 3 def identifier @identifier end |
#opr ⇒ Object
Returns the value of attribute opr
3 4 5 |
# File 'lib/querly/check.rb', line 3 def opr @opr end |
#tags ⇒ Object
Returns the value of attribute tags
3 4 5 |
# File 'lib/querly/check.rb', line 3 def @tags end |
Instance Method Details
#apply(current:, all:) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/querly/check.rb', line 4 def apply(current:, all:) case opr when :append current.union(all.select {|rule| match?(rule) }) when :except current.reject {|rule| match?(rule) }.to_set when :only all.select {|rule| match?(rule) }.to_set end end |
#match?(rule) ⇒ Boolean
15 16 17 |
# File 'lib/querly/check.rb', line 15 def match?(rule) rule.match?(identifier: identifier, tags: ) end |