Class: Fastererer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/fastererer/analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Analyzer

Returns a new instance of Analyzer.



19
20
21
22
# File 'lib/fastererer/analyzer.rb', line 19

def initialize(file_path)
  @file_path = file_path.to_s
  @file_content = File.read(file_path)
end

Instance Attribute Details

#file_pathObject (readonly) Also known as: path

Returns the value of attribute file_path.



16
17
18
# File 'lib/fastererer/analyzer.rb', line 16

def file_path
  @file_path
end

Instance Method Details

#errorsObject



29
30
31
# File 'lib/fastererer/analyzer.rb', line 29

def errors
  @errors ||= Fastererer::OffenseCollector.new
end

#scanObject



24
25
26
27
# File 'lib/fastererer/analyzer.rb', line 24

def scan
  root_node = Fastererer::Parser.parse(@file_content)
  root_node.accept(AnalyzerVisitor.new(errors))
end