Sha256: f1463f596369eafc6867782ff8bad159ba0e0ef0fd5db223a35b6905b38871ef

Contents?: true

Size: 759 Bytes

Versions: 37

Compression:

Stored size: 759 Bytes

Contents

module RailsBestPractices
  module Core
    class CheckingVisitor
      def initialize(*checks)
        @checks ||= {}
        checks.first.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

37 entries across 37 versions & 1 rubygems

Version Path
rails_best_practices-0.3.17 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.16 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.15 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.14 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.13 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.12 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.11 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.10 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.9 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.8 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.7 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.6 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.5 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.4 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.3 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.2 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.1 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.0 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.2.16 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.2.15 lib/rails_best_practices/core/checking_visitor.rb