Class: Depdump::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



5
6
7
# File 'lib/depdump/parser.rb', line 5

def initialize
  @tracer = Tracer.new
end

Instance Attribute Details

#tracerObject (readonly)

Returns the value of attribute tracer.



3
4
5
# File 'lib/depdump/parser.rb', line 3

def tracer
  @tracer
end

Instance Method Details

#dependency_graphObject



17
18
19
# File 'lib/depdump/parser.rb', line 17

def dependency_graph
  DependencyGraph.new(tracer.registry_tree)
end

#parse(files) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/depdump/parser.rb', line 9

def parse(files)
  expand_directory(files).each do |file|
    source = File.read(file)
    ast = ::Parser::CurrentRuby.parse(source)
    tracer.trace_node(ast)
  end
end