Class: Deadlyzer::AST::Parser
- Inherits:
-
Object
- Object
- Deadlyzer::AST::Parser
- Defined in:
- lib/deadlyzer/ast_parser.rb
Instance Attribute Summary collapse
- #ast ⇒ Object readonly
- #file ⇒ Object readonly
- #parser ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(parser: nil) ⇒ Parser
constructor
A new instance of Parser.
- #parse(code, file = nil) ⇒ Object private
Constructor Details
#initialize(parser: nil) ⇒ Parser
Returns a new instance of Parser.
18 19 20 |
# File 'lib/deadlyzer/ast_parser.rb', line 18 def initialize(parser: nil) @parser = parser || default_parser end |
Instance Attribute Details
#ast ⇒ Object (readonly)
13 14 15 |
# File 'lib/deadlyzer/ast_parser.rb', line 13 def ast @ast end |
#file ⇒ Object (readonly)
16 17 18 |
# File 'lib/deadlyzer/ast_parser.rb', line 16 def file @file end |
#parser ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/deadlyzer/ast_parser.rb', line 10 def parser @parser end |
Instance Method Details
#parse(code, file = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 |
# File 'lib/deadlyzer/ast_parser.rb', line 24 def parse(code, file = nil) processed_source = parse_code(code, file) @ast = processed_source.ast @file = processed_source.path self end |