Class: ThinkingSphinx::Masks::GroupEnumeratorsMask

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

Instance Method Summary collapse

Constructor Details

#initialize(search) ⇒ GroupEnumeratorsMask

Returns a new instance of GroupEnumeratorsMask.



4
5
6
# File 'lib/thinking_sphinx/masks/group_enumerators_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/group_enumerators_mask.rb', line 8

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

#each_with_count(&block) ⇒ Object



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

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

#each_with_group(&block) ⇒ Object



18
19
20
21
22
# File 'lib/thinking_sphinx/masks/group_enumerators_mask.rb', line 18

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

#each_with_group_and_count(&block) ⇒ Object



24
25
26
27
28
29
# File 'lib/thinking_sphinx/masks/group_enumerators_mask.rb', line 24

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