Class: Droonga::Searcher::ResultFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/searcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_request, search_result) ⇒ ResultFormatter

Returns a new instance of ResultFormatter.



562
563
564
565
# File 'lib/droonga/searcher.rb', line 562

def initialize(search_request, search_result)
  @request = search_request
  @result = search_result
end

Class Method Details

.format(search_request, search_result) ⇒ Object



557
558
559
# File 'lib/droonga/searcher.rb', line 557

def format(search_request, search_result)
  new(search_request, search_result).format
end

Instance Method Details

#formatObject



567
568
569
570
571
572
573
574
575
576
577
# File 'lib/droonga/searcher.rb', line 567

def format
  formatted_result = {}

  output_elements.each do |name|
    value = format_element(name)
    next if value.nil?
    formatted_result[name] = value
  end

  formatted_result
end