Class: Yuriita::Clauses::Filter
- Inherits:
-
Object
- Object
- Yuriita::Clauses::Filter
- Defined in:
- lib/yuriita/clauses/filter.rb
Instance Method Summary collapse
- #apply(relation) ⇒ Object
-
#initialize(filters:, combination:) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(filters:, combination:) ⇒ Filter
Returns a new instance of Filter.
4 5 6 7 |
# File 'lib/yuriita/clauses/filter.rb', line 4 def initialize(filters:, combination:) @filters = filters @combination = combination end |
Instance Method Details
#apply(relation) ⇒ Object
9 10 11 12 |
# File 'lib/yuriita/clauses/filter.rb', line 9 def apply(relation) relations = filters.map { |filter| filter.apply(relation) } combination.new(base_relation: relation, relations: relations).combine end |