Class: RailsBestPractices::Core::CheckingVisitor

### Home Classes Methods

### In Files

- lib/rails_best_practices/core/checking_visitor.rb

### Parent

Object

### Methods

- ::new
- #visit

### Files

- LICENSE

### Class/Module Index

Quicksearch

- RailsBestPractices
- RailsBestPractices::Checks
- RailsBestPractices::Checks::AddModelVirtualAttributeCheck
- RailsBestPractices::Checks::AlwaysAddDbIndexCheck
- RailsBestPractices::Checks::Check
- RailsBestPractices::Checks::IsolateSeedDataCheck
- RailsBestPractices::Checks::KeepFindersOnTheirOwnModelCheck
- RailsBestPractices::Checks::LawOfDemeterCheck
- RailsBestPractices::Checks::ManyToManyCollectionCheck
- RailsBestPractices::Checks::MoveCodeIntoControllerCheck
- RailsBestPractices::Checks::MoveCodeIntoHelperCheck
- RailsBestPractices::Checks::MoveCodeIntoModelCheck
- RailsBestPractices::Checks::MoveFinderToNamedScopeCheck
- RailsBestPractices::Checks::MoveModelLogicIntoModelCheck
- RailsBestPractices::Checks::NeedlessDeepNestingCheck
- RailsBestPractices::Checks::NestedModelFormsCheck
- RailsBestPractices::Checks::NotUseDefaultRouteCheck
- RailsBestPractices::Checks::OveruseRouteCustomizationsCheck
- RailsBestPractices::Checks::ReplaceComplexCreationWithFactoryMethodCheck
- RailsBestPractices::Checks::ReplaceInstanceVariableWithLocalVariableCheck
- RailsBestPractices::Checks::UseBeforeFilterCheck
- RailsBestPractices::Checks::UseModelAssociationCheck
- RailsBestPractices::Checks::UseModelCallbackCheck
- RailsBestPractices::Checks::UseObserverCheck
- RailsBestPractices::Checks::UseScopeAccessCheck
- RailsBestPractices::Core
- RailsBestPractices::Core::CheckingVisitor
- RailsBestPractices::Core::Error
- RailsBestPractices::Core::Runner
- Enumerable
- NilClass
- Sexp
- String

No matching classes.

# RailsBestPractices::Core::CheckingVisitor

### Public Class Methods

new(checks) click to toggle source

    # File lib/rails_best_practices/core/checking_visitor.rb, line 4
    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

### Public Instance Methods

visit(node) click to toggle source

    # File lib/rails_best_practices/core/checking_visitor.rb, line 16
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.