Module: Fairy::GroupBy::Interface

Defined in:
lib/fairy/client/group-by.rb

Instance Method Summary collapse

Instance Method Details

#group_by(hash_block, opts = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fairy/client/group-by.rb', line 13

def group_by(hash_block, opts = nil)
  
  klass_name = opts[:group_by] if opts
  klass_name ||= CONF.GROUP_BY
  klass = ::Fairy::const_get(klass_name)

  hash_block = BlockSource.new(hash_block) 
  mod_group_by = klass.new(@fairy, opts, hash_block)
  mod_group_by.input = self
  mod_group_by
end

#xgroup_by(hash_block, opts = nil) ⇒ Object



25
26
27
28
29
30
# File 'lib/fairy/client/group-by.rb', line 25

def xgroup_by(hash_block, opts = nil)
  hash_block = BlockSource.new(hash_block) 
  xgroup_by = XGroupBy.new(@fairy, opts, hash_block)
  xgroup_by.input = self
  xgroup_by
end