diff options
Diffstat (limited to 'lib/arel/visitors/depth_first.rb')
-rw-r--r-- | lib/arel/visitors/depth_first.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/arel/visitors/depth_first.rb b/lib/arel/visitors/depth_first.rb index 458934f854..4d2ecfa5e1 100644 --- a/lib/arel/visitors/depth_first.rb +++ b/lib/arel/visitors/depth_first.rb @@ -5,22 +5,11 @@ module Arel @block = block || Proc.new end - def accept object - visit object - end - private - def visit object - send dispatch[object.class], object - rescue NoMethodError => e - raise e if respond_to?(dispatch[object.class], true) - superklass = object.class.ancestors.find { |klass| - respond_to?(dispatch[klass], true) - } - raise(TypeError, "Cannot visit #{object.class}") unless superklass - dispatch[object.class] = dispatch[superklass] - retry + def visit o + super + @block.call o end def unary o |