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

Returns a new instance of WeightEnumeratorMask.



4
5
6
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 4

def initialize(search)
  @search = search
end

Instance Method Details

#can_handle?(method) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 8

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

#each_with_weight(&block) ⇒ Object



12
13
14
15
16
# File 'lib/thinking_sphinx/masks/weight_enumerator_mask.rb', line 12

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