Class: Fasterer::Analyzer
- Inherits:
-
Object
- Object
- Fasterer::Analyzer
- Defined in:
- lib/fasterer/analyzer.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
(also: #path)
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(file_path) ⇒ Analyzer
constructor
A new instance of Analyzer.
- #scan ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Analyzer
Returns a new instance of Analyzer.
16 17 18 19 |
# File 'lib/fasterer/analyzer.rb', line 16 def initialize(file_path) @file_path = file_path @file_content = File.read(file_path) end |
Instance Attribute Details
#file_path ⇒ Object (readonly) Also known as: path
Returns the value of attribute file_path.
13 14 15 |
# File 'lib/fasterer/analyzer.rb', line 13 def file_path @file_path end |
Instance Method Details
#errors ⇒ Object
27 28 29 |
# File 'lib/fasterer/analyzer.rb', line 27 def errors @errors ||= Fasterer::OffenseCollector.new end |
#scan ⇒ Object
21 22 23 24 25 |
# File 'lib/fasterer/analyzer.rb', line 21 def scan sexp_tree = Fasterer::Parser.parse(@file_content) fail ParseError.new(file_path) if sexp_tree.nil? traverse_sexp_tree(sexp_tree) end |