Class Roodi::Core::Runner
In: lib/roodi/core/runner.rb
Parent: Object

Methods

Constants

DEFAULT_CONFIG = File.join(File.dirname(__FILE__), "..", "..", "..", "roodi.yml")

Attributes

config  [W] 

Public Class methods

[Source]

# File lib/roodi/core/runner.rb, line 15
      def initialize(*checks)
        @config = DEFAULT_CONFIG
        @checks = checks unless checks.empty?
        @checks ||= load_checks
        @checker ||= CheckingVisitor.new(@checks)
        @parser = Parser.new
      end

Public Instance methods

[Source]

# File lib/roodi/core/runner.rb, line 23
      def check(filename, content)
        node = parse(filename, content)
        node.accept(@checker) if node
      end

[Source]

# File lib/roodi/core/runner.rb, line 28
      def check_content(content)
        check("dummy-file.rb", content)
      end

[Source]

# File lib/roodi/core/runner.rb, line 32
      def check_file(filename)
        check(filename, File.read(filename))
      end

[Source]

# File lib/roodi/core/runner.rb, line 50
      def errors
        @checks ||= []
        all_errors = @checks.collect {|check| check.errors}
        all_errors.flatten
      end

[Source]

# File lib/roodi/core/runner.rb, line 36
      def print(filename, content)
        node = @parser.parse(content, filename)
        puts "Line: #{node.line}"
        pp node
      end

[Source]

# File lib/roodi/core/runner.rb, line 42
      def print_content(content)
        print("dummy-file.rb", content)
      end

[Source]

# File lib/roodi/core/runner.rb, line 46
      def print_file(filename)
        print(filename, File.read(filename))
      end

[Validate]