Class: DataMapper::Adapters::Sphinx::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/dm-sphinx-adapter/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ Collection

Returns a new instance of Collection.



7
8
9
10
11
12
13
14
# File 'lib/dm-sphinx-adapter/collection.rb', line 7

def initialize(result)
  # TODO: One liner that works in Ruby 1.x now #indexes is #keys?
  @error   = result[:error]
  @time    = result[:time]
  @total   = result[:total]
  @words   = result[:words]
  super result[:matches].map{|doc| doc[:id] = doc[:doc]; doc}
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



5
6
7
# File 'lib/dm-sphinx-adapter/collection.rb', line 5

def error
  @error
end

#timeObject

Returns the value of attribute time.



5
6
7
# File 'lib/dm-sphinx-adapter/collection.rb', line 5

def time
  @time
end

#totalObject

Returns the value of attribute total.



5
6
7
# File 'lib/dm-sphinx-adapter/collection.rb', line 5

def total
  @total
end

#wordsObject

Returns the value of attribute words.



5
6
7
# File 'lib/dm-sphinx-adapter/collection.rb', line 5

def words
  @words
end