Class: Getto::Params::Search::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/getto/params/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(sort:, query:, result:) ⇒ Worker

Returns a new instance of Worker.



17
18
19
20
21
# File 'lib/getto/params/search.rb', line 17

def initialize(sort:, query:, result:)
  @sort = sort
  @query = query
  @result = result
end

Instance Method Details

#query(&block) ⇒ Object



27
28
29
# File 'lib/getto/params/search.rb', line 27

def query(&block)
  @result.merge!(query: @query.to_h(&block))
end

#sort(&block) ⇒ Object



23
24
25
# File 'lib/getto/params/search.rb', line 23

def sort(&block)
  @result.merge!(sort: @sort.to_h(&block))
end