Sha256: b0e2f8c1348361068f727ec8f60c76f42f7c0869e6c4307d62f70bf46240faf8

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Simplabs

  module Excellent

    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)
          @last_newline = node if node.node_type == :newline
          checks = @checks[node.node_type]
          checks.each { |check| check.evaluate_node(node) } unless checks.nil?
          nil
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 lib/simplabs/excellent/core/checking_visitor.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/core/checking_visitor.rb