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

- (GroupPipe) initialize

Returns a new instance of GroupPipe



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

- (Object) addKeyPipe(from_pipe, to_pipe)



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

- (Object) addValuesPipe(name, from_pipe, to_pipe)



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

- (Object) hasNext



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

- (Object) setUnique(bool)



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

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