Sha256: 0983f649f23f236e60118bbb8bf197798f62a420f7316b044ecf125062b42884

Contents?: true

Size: 345 Bytes

Versions: 21

Compression:

Stored size: 345 Bytes

Contents

module Johnson
  module Visitors
    class EnumeratingVisitor < Visitor
      attr_accessor :block
      def initialize(block)
        @block = block
      end

      superclass.instance_methods.each do |method|
        next unless method.to_s =~ /^visit_/
        eval("def #{method}(o); block.call(o); super; end")
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
jbarnette-johnson-1.0.0.20090127202936 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090225110820 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090326122910 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090326154650 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090326161333 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090402144841 lib/johnson/visitors/enumerating_visitor.rb
jbarnette-johnson-1.0.0.20090402155420 lib/johnson/visitors/enumerating_visitor.rb
johnson19-2.0.0.pre3 lib/johnson/visitors/enumerating_visitor.rb
pre-johnson-2.0.0 lib/johnson/visitors/enumerating_visitor.rb
johnson-2.0.0.pre3 lib/johnson/visitors/enumerating_visitor.rb
johnson-2.0.0.pre2 lib/johnson/visitors/enumerating_visitor.rb
johnson-2.0.0.pre1 lib/johnson/visitors/enumerating_visitor.rb
johnson-2.0.0.pre0 lib/johnson/visitors/enumerating_visitor.rb
johnson-1.2.0 lib/johnson/visitors/enumerating_visitor.rb
smparkes-johnson-1.1.2.6 lib/johnson/visitors/enumerating_visitor.rb
smparkes-johnson-1.1.2.5 lib/johnson/visitors/enumerating_visitor.rb
smparkes-johnson-1.1.2.4 lib/johnson/visitors/enumerating_visitor.rb
smparkes-johnson-1.1.2.3 lib/johnson/visitors/enumerating_visitor.rb
johnson-1.1.1 lib/johnson/visitors/enumerating_visitor.rb
johnson-1.1.2 lib/johnson/visitors/enumerating_visitor.rb