Class: AppMap::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/parser.rb

Direct Known Subclasses

Inspect::Parser, RSpec::Parser

Instance Method Summary collapse

Constructor Details

#initialize(file_path: nil, code: nil) ⇒ Parser

Returns a new instance of Parser.



6
7
8
9
# File 'lib/appmap/parser.rb', line 6

def initialize(file_path: nil, code: nil)
  @file_path = file_path
  @code = code
end

Instance Method Details

#parseObject

Parse the contents of a file into a list of features.



16
17
18
19
20
# File 'lib/appmap/parser.rb', line 16

def parse
  parse_tree, comments = parse_code_and_comments
  parse_nodes = build_parse_nodes parse_tree
  [ parse_nodes, comments ]
end

#to_sObject



11
12
13
# File 'lib/appmap/parser.rb', line 11

def to_s
  "Parse code #{file_path.inspect}"
end