Class: ThinkingSphinx::Masks::WeightEnumeratorMask

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/masks/weight_enumerator_mask.rb

Instance Method Summary collapse

Constructor Details

#initialize(search) ⇒ WeightEnumeratorMask



2
3
4
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 2

def initialize(search)
  @search = search
end

Instance Method Details

#can_handle?(method) ⇒ Boolean



6
7
8
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 6

def can_handle?(method)
  public_methods(false).include?(method)
end

#each_with_weight(&block) ⇒ Object



10
11
12
13
14
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 10

def each_with_weight(&block)
  @search.raw.each_with_index do |row, index|
    yield @search[index], row['@weight']
  end
end