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.



643
644
645
646
# File 'lib/droonga/searcher.rb', line 643

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

Class Method Details

.format(search_request, search_result) ⇒ Object



638
639
640
# File 'lib/droonga/searcher.rb', line 638

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

Instance Method Details

#formatObject



648
649
650
651
652
653
654
655
656
657
658
# File 'lib/droonga/searcher.rb', line 648

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