Class: Wukong::Processor::GroupConcat
- Inherits:
-
Group
- Object
- Hanuman::Stage
- Wukong::Processor
- Accumulator
- Count
- Group
- Wukong::Processor::GroupConcat
- Defined in:
- lib/wukong/widget/reducers/group_concat.rb
Overview
Concatenates the elements of a group, yielding the group key, the count, and its members.
GroupConcat takes all the same options as Group.
Constant Summary
Constants inherited from Wukong::Processor
Instance Attribute Summary collapse
-
#members ⇒ Object
The members of the current group.
Attributes inherited from Count
Attributes inherited from Accumulator
Attributes included from Hanuman::StageInstanceMethods
Instance Method Summary collapse
-
#accumulate(record) ⇒ Object
Accumulate each record, adding it to the current members.
-
#finalize {|key, size, *members| ... } ⇒ Object
Yields the group, including its key, its size, and each member.
-
#setup ⇒ Object
Initializes the empty members array.
-
#start(record) ⇒ Object
Initializes the empty members array.
Methods inherited from Group
Methods included from DynamicGet
Methods inherited from Count
Methods inherited from Accumulator
Methods inherited from Wukong::Processor
configure, description, #perform_action, #process, #receive_action, #stop
Methods included from Logging
Methods inherited from Hanuman::Stage
Methods included from Hanuman::StageClassMethods
#builder, #label, #register, #set_builder
Methods included from Hanuman::StageInstanceMethods
#add_link, #linkable_name, #root
Instance Attribute Details
#members ⇒ Object
The members of the current group.
55 56 57 |
# File 'lib/wukong/widget/reducers/group_concat.rb', line 55 def members @members end |
Instance Method Details
#accumulate(record) ⇒ Object
Accumulate each record, adding it to the current members.
74 75 76 77 |
# File 'lib/wukong/widget/reducers/group_concat.rb', line 74 def accumulate record super(record) self.members << record end |
#finalize {|key, size, *members| ... } ⇒ Object
Yields the group, including its key, its size, and each member.
86 87 88 89 90 |
# File 'lib/wukong/widget/reducers/group_concat.rb', line 86 def finalize group = [key, size] group.concat(members) yield group end |
#setup ⇒ Object
Initializes the empty members array.
58 59 60 61 |
# File 'lib/wukong/widget/reducers/group_concat.rb', line 58 def setup super() @members = [] end |
#start(record) ⇒ Object
Initializes the empty members array.
66 67 68 69 |
# File 'lib/wukong/widget/reducers/group_concat.rb', line 66 def start record super(record) self.members = [] end |