Class: DependencyGrapher::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency_grapher/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



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

def initialize
  @dependencies = {}
  @keys = Set.new
  @call_stack = []
  @methods = {}
  @trace = get_trace_point
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



8
9
10
# File 'lib/dependency_grapher/logger.rb', line 8

def dependencies
  @dependencies
end

Instance Method Details

#disableObject



21
22
23
# File 'lib/dependency_grapher/logger.rb', line 21

def disable
  @trace.disable
end

#dump(filename = "dependencies.yml") ⇒ Object



25
26
27
28
29
30
31
# File 'lib/dependency_grapher/logger.rb', line 25

def dump(filename = "dependencies.yml")
  file = File.open(filename, "w")
  @keys.each do |key|
    file.puts @dependencies[key].serialize
    file.puts
  end
end

#enableObject



17
18
19
# File 'lib/dependency_grapher/logger.rb', line 17

def enable
  @trace.enable
end