Class: Pacer::Pipes::GroupPipe

Inherits:
RubyPipe
  • Object
show all
Defined in:
lib/pacer/pipe/group_pipe.rb

Instance Attribute Summary

Attributes inherited from RubyPipe

#starts

Instance Method Summary collapse

Methods inherited from RubyPipe

#setStarts

Constructor Details

#initializeGroupPipe



3
4
5
6
7
8
9
10
# File 'lib/pacer/pipe/group_pipe.rb', line 3

def initialize
  super()
  @next_key = nil
  @key_pipes = []
  @values_pipes = []
  @current_keys = []
  @current_values = nil
end

Instance Method Details

#addKeyPipe(from_pipe, to_pipe) ⇒ Object



17
18
19
# File 'lib/pacer/pipe/group_pipe.rb', line 17

def addKeyPipe(from_pipe, to_pipe)
  @key_pipes << prepare_aggregate_pipe(from_pipe, to_pipe)
end

#addValuesPipe(name, from_pipe, to_pipe) ⇒ Object



21
22
23
# File 'lib/pacer/pipe/group_pipe.rb', line 21

def addValuesPipe(name, from_pipe, to_pipe)
  @values_pipes << [name, *prepare_aggregate_pipe(from_pipe, to_pipe)]
end

#hasNextObject



25
26
27
28
29
30
31
32
33
# File 'lib/pacer/pipe/group_pipe.rb', line 25

def hasNext
  !!@nextKey or super
rescue NativeException => e
  if e.cause.getClass == Pacer::NoSuchElementException.getClass
    raise e.cause
  else
    raise e
  end
end

#setUnique(bool) ⇒ Object



12
13
14
15
# File 'lib/pacer/pipe/group_pipe.rb', line 12

def setUnique(bool)
  @unique = unique
  @groups = {}
end