Class: Fasterer::Analyzer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Analyzer

Returns a new instance of Analyzer.



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

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.



12
13
14
# File 'lib/fasterer/analyzer.rb', line 12

def file_path
  @file_path
end

Instance Method Details

#errorsObject



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

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

#scanObject



20
21
22
23
# File 'lib/fasterer/analyzer.rb', line 20

def scan
  sexp_tree = Fasterer::Parser.parse(@file_content)
  traverse_sexp_tree(sexp_tree)
end