Sha256: c5cd01d26c88cfe871b58c7221a0184634bb1633143fa40bd7b6bc3bb5d7fe1b

Contents?: true

Size: 752 Bytes

Versions: 13

Compression:

Stored size: 752 Bytes

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
rails_best_practices-0.4.2 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.1 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.4.0 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.27 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.26 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.25 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.24 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.23 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.22 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.21 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.20 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.19 lib/rails_best_practices/core/checking_visitor.rb
rails_best_practices-0.3.18 lib/rails_best_practices/core/checking_visitor.rb