Class: DepsGrapher::Context

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/deps_grapher/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Context

Returns a new instance of Context.



16
17
18
19
# File 'lib/deps_grapher/context.rb', line 16

def initialize(config)
  @config = config
  @event_processors = {}
end

Instance Attribute Details

#advanced_const_resolverObject

Returns the value of attribute advanced_const_resolver.



14
15
16
# File 'lib/deps_grapher/context.rb', line 14

def advanced_const_resolver
  @advanced_const_resolver
end

#event_processorsObject

Returns the value of attribute event_processors.



14
15
16
# File 'lib/deps_grapher/context.rb', line 14

def event_processors
  @event_processors
end

Instance Method Details

#clean_dir!Object



21
22
23
24
25
# File 'lib/deps_grapher/context.rb', line 21

def clean_dir!
  return unless @config.clean

  FileUtils.rm_rf @config.output_dir
end

#create_graphObject



44
45
46
# File 'lib/deps_grapher/context.rb', line 44

def create_graph
  target_path ? Graph.new : NullGraph.new
end

#create_visualizerObject



39
40
41
42
# File 'lib/deps_grapher/context.rb', line 39

def create_visualizer
  downloader = Visualizer::Downloader.new @config.output_dir
  Visualizer.fetch(@config.visualizer).new downloader, @config.visualizer_options
end

#create_writerObject



35
36
37
# File 'lib/deps_grapher/context.rb', line 35

def create_writer
  HtmlWriter.new @config.output_dir
end

#generate_graphile(dest) ⇒ Object



27
28
29
# File 'lib/deps_grapher/context.rb', line 27

def generate_graphile(dest)
  Graphile::Generator.new(@config).call dest
end

#generate_temp_graphileObject



31
32
33
# File 'lib/deps_grapher/context.rb', line 31

def generate_temp_graphile
  generate_graphile nil
end