Sha256: 727d2accce2070b8d87ed2ad5b37b75e73b62a97b6c5f48ea2b050589c0d3e9f

Contents?: true

Size: 770 Bytes

Versions: 8

Compression:

Stored size: 770 Bytes

Contents

# encoding: utf-8
module RailsBestPractices
  module Core
    class CheckingVisitor
      def initialize(checks)
        @checks ||= {}
        checks.each do |check|
          nodes = check.interesting_nodes
          nodes.each do |node|
            @checks[node] ||= []
            @checks[node] << check
            @checks[node].uniq!
          end
        end
      end

    	def visit(node)
        checks = @checks[node.node_type]
        checks.each {|check| check.evaluate_node_start(node) if node.file =~ check.interesting_files} unless checks.nil?

    		node.visitable_children.each {|sexp| sexp.accept(self)}

        checks.each {|check| check.evaluate_node_end(node) if node.file =~ check.interesting_files} unless checks.nil?
    	end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_best_practices-0.5.3 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.5.2 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.5.1 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.5.0 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.6 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.5 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.4 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.3 lib/rails_best_practices/core/checking_visitor.rb