Class: Yuriita::Clauses::Search
- Inherits:
-
Object
- Object
- Yuriita::Clauses::Search
- Defined in:
- lib/yuriita/clauses/search.rb
Instance Method Summary collapse
- #apply(relation) ⇒ Object
-
#initialize(filters:, keywords:, combination:) ⇒ Search
constructor
A new instance of Search.
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 |