Class: ActiveSearch::Result

Inherits:
Hash
  • Object
show all
Defined in:
lib/activesearch/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ Result

Returns a new instance of Result.



3
4
5
6
7
8
9
# File 'lib/activesearch/result.rb', line 3

def initialize(result)
  result.to_hash.each do |k,v|
    unless v.nil?
      self[k.to_s] = v.respond_to?(:has_key?) && v.has_key?(I18n.locale.to_s) ? v[I18n.locale.to_s] : v
    end
  end
end