Class: Yuriita::Clauses::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/yuriita/clauses/filter.rb

Instance Method Summary collapse

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