Class: ImportGraph::Parser::Load
- Inherits:
-
Object
- Object
- ImportGraph::Parser::Load
- Includes:
- Util, RuboCop::AST
- Defined in:
- lib/import_graph/parser/load.rb
Constant Summary collapse
- LOAD_PATTERN =
NodePattern.new <<~PATTERN (send nil? :load (str $_))#{' '} PATTERN
Instance Method Summary collapse
-
#initialize(file_trees) ⇒ Load
constructor
A new instance of Load.
- #parse ⇒ Object
- #parse_file(file_path) ⇒ Object
Methods included from Util
#build_match_object, #cleanup_absolute_path
Constructor Details
#initialize(file_trees) ⇒ Load
Returns a new instance of Load.
13 14 15 |
# File 'lib/import_graph/parser/load.rb', line 13 def initialize(file_trees) @file_trees = file_trees end |
Instance Method Details
#parse ⇒ Object
17 18 19 20 21 |
# File 'lib/import_graph/parser/load.rb', line 17 def parse matches = Set.new @file_trees.keys.each { |file_path| matches.merge(parse_file(file_path)) } matches end |
#parse_file(file_path) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/import_graph/parser/load.rb', line 23 def parse_file(file_path) matches = Set.new @file_trees[file_path].each_node do |node| match = LOAD_PATTERN.match node next if match.nil? matches.add(build_match_object(:load, file_path, match)) unless match.nil? end matches end |