Sha256: 49dcf8ae8c01dec9d430098c1fdfc8df69e7bc636bf47eef36327857712a775c

Contents?: true

Size: 328 Bytes

Versions: 3

Compression:

Stored size: 328 Bytes

Contents

module Arel
  module Visitors
    class Visitor
      def accept object
        visit object
      end

      private

      DISPATCH = Hash.new do |hash, klass|
        hash[klass] = "visit_#{klass.name.gsub('::', '_')}"
      end

      def visit object
        send DISPATCH[object.class], object
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arel-2.0.4 lib/arel/visitors/visitor.rb
arel-2.0.3 lib/arel/visitors/visitor.rb
arel-2.0.2 lib/arel/visitors/visitor.rb