Class: Yuriita::Clauses::Search

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

Instance Method Summary collapse

Constructor Details

#initialize(filters:, keywords:, combination:) ⇒ Search

Returns a new instance of Search.



4
5
6
7
8
# File 'lib/yuriita/clauses/search.rb', line 4

def initialize(filters:, keywords:, combination:)
  @filters = filters
  @keywords = keywords
  @combination = combination
end

Instance Method Details

#apply(relation) ⇒ Object



10
11
12
13
# File 'lib/yuriita/clauses/search.rb', line 10

def apply(relation)
  relations = filters.map { |filter| filter.apply(relation, keywords) }
  combination.new(base_relation: relation, relations: relations).combine
end