Sha256: 418d39cad7849f331681f6e1e6c60e7db37a9b76dba731dc5d7a128c758c2ab8

Contents?: true

Size: 666 Bytes

Versions: 31

Compression:

Stored size: 666 Bytes

Contents

require 'arel/visitors/visitor'

module Arel
  module Visitors
    class Reduce < Arel::Visitors::Visitor
      def accept object, collector
        visit object, collector
      end

      private

      def visit object, collector
        send dispatch[object.class], object, collector
      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
      end
    end
  end
end

Version data entries

31 entries across 30 versions & 9 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/arel-6.0.4/lib/arel/visitors/reduce.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-7.1.4/lib/arel/visitors/reduce.rb
abaci-0.3.0 vendor/bundle/gems/arel-7.1.0/lib/arel/visitors/reduce.rb
arel-6.0.4 lib/arel/visitors/reduce.rb
arel-7.1.4 lib/arel/visitors/reduce.rb
arel-7.1.3 lib/arel/visitors/reduce.rb
arel-7.1.2 lib/arel/visitors/reduce.rb
arel-7.1.1 lib/arel/visitors/reduce.rb
arel-7.1.0 lib/arel/visitors/reduce.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-6.0.3/lib/arel/visitors/reduce.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/visitors/reduce.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/visitors/reduce.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/visitors/reduce.rb