Class: Mago::Detector
- Inherits:
-
Object
- Object
- Mago::Detector
- Defined in:
- lib/mago/detector.rb
Instance Method Summary collapse
-
#initialize(file_paths = [], options = {}) ⇒ Detector
constructor
A new instance of Detector.
- #process_file(path) ⇒ Object
- #run ⇒ Object
Constructor Details
Instance Method Details
#process_file(path) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mago/detector.rb', line 16 def process_file(path) code = File.read(path) sexp_node = RubyParser.new.parse(code) file = Mago::RubyFile.new(path) sexp_processor = Mago::SexpProcessor.new(file, @ignore) sexp_processor.process sexp_node @report.files << file rescue Errno::ENOENT => err @report.errors << err. rescue Racc::ParseError => err msg = "#{path} has invalid ruby code. " << err. @report.errors << msg end |
#run ⇒ Object
9 10 11 12 13 14 |
# File 'lib/mago/detector.rb', line 9 def run @file_paths.each do |path| process_file(path) end @report end |