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.



634
635
636
637
# File 'lib/droonga/searcher.rb', line 634

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

Class Method Details

.format(search_request, search_result) ⇒ Object



629
630
631
# File 'lib/droonga/searcher.rb', line 629

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

Instance Method Details

#formatObject



639
640
641
642
643
644
645
646
647
648
649
# File 'lib/droonga/searcher.rb', line 639

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