Class: ImportGraph::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/import_graph/scanner.rb

Overview

Scanner class is the starting interface though which you interact with the gem.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir_path, config) ⇒ Scanner

Returns a new instance of Scanner.

Parameters:

  • dir_path (String)

    Absolute path of the directory that you want scanned

  • config (Hash)

    Configuration for the Scanner



11
12
13
14
15
# File 'lib/import_graph/scanner.rb', line 11

def initialize(dir_path, config)
  @dir_path = dir_path
  @graph = nil
  @config = config
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



7
8
9
# File 'lib/import_graph/scanner.rb', line 7

def graph
  @graph
end

Instance Method Details

#generate_graphObject



17
18
19
20
# File 'lib/import_graph/scanner.rb', line 17

def generate_graph
  main_parser = Parser::Main.new(@dir_path, @config)
  @graph = main_parser.parse
end

#get_dependees_from_file(file_path) ⇒ Object



26
27
28
# File 'lib/import_graph/scanner.rb', line 26

def get_dependees_from_file(file_path)
  @graph.get_dependee_files(file_path)
end

#get_dependents_from_file(file_path) ⇒ Object



22
23
24
# File 'lib/import_graph/scanner.rb', line 22

def get_dependents_from_file(file_path)
  @graph.get_dependent_files(file_path)
end