lib/bmg/operator/rename.rb in bmg-0.5.0 vs lib/bmg/operator/rename.rb in bmg-0.6.0
- old
+ new
@@ -12,22 +12,21 @@
# Keys of the renaming Hash SHOULD be existing attributes of the
# input tuples. Values of the renaming Hash SHOULD NOT be existing
# attributes of the input tuples.
#
class Rename
- include Operator
+ include Operator::Unary
def initialize(type, operand, renaming)
@type = type
@operand = operand
@renaming = renaming
end
- attr_reader :type
private
- attr_reader :operand, :renaming
+ attr_reader :renaming
public
def each
@operand.each do |tuple|
@@ -63,9 +62,15 @@
protected ### optimization
def _restrict(type, predicate)
operand.restrict(predicate.rename(reverse_renaming)).rename(renaming)
+ end
+
+ protected ### inspect
+
+ def args
+ [ renaming ]
end
private
def rename(tuple, renaming)