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

- (GroupEnumeratorsMask) initialize(search)

Returns a new instance of GroupEnumeratorsMask



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

def initialize(search)
  @search = search
end

Instance Method Details

- (Boolean) can_handle?(method)

Returns:

  • (Boolean)


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

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

- (Object) each_with_count(&block)



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

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

- (Object) each_with_group(&block)



16
17
18
19
20
# File 'lib/thinking_sphinx/masks/group_enumerators_mask.rb', line 16

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

- (Object) each_with_group_and_count(&block)



22
23
24
25
26
# File 'lib/thinking_sphinx/masks/group_enumerators_mask.rb', line 22

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