lib/alf/operator/relational/heading.rb in alf-0.10.1 vs lib/alf/operator/relational/heading.rb in alf-0.11.0
- old
+ new
@@ -1,30 +1,20 @@
module Alf
- module Operator::Relational
- class Heading < Alf::Operator()
- include Operator::Relational,
- Operator::Experimental,
- Operator::Unary
-
- signature do |s|
- end
+ module Operator
+ module Relational
+ class Heading
+ include Relational, Unary, Experimental
+
+ signature do |s|
+ end
- protected
-
- # See Operator#_prepare
- def _prepare
- @tuple_heading = nil
- each_input_tuple do |tuple|
- h = tuple_heading(tuple)
- @tuple_heading ||= h
- @tuple_heading += h
+ # (see Operator#each)
+ def each
+ yield(operand.inject(Alf::Heading::EMPTY){|h,t|
+ h + Tools.tuple_heading(t)
+ }.to_h)
end
- end
- # See Operator#_each
- def _each
- yield(@tuple_heading.attributes)
- end
-
- end # class Project
- end # module Operator::Relational
+ end # class Project
+ end # module Relational
+ end # module Operator
end # module Alf