Class: MethodCallTree

Inherits:
Object
  • Object
show all
Defined in:
lib/method_call_tree.rb,
lib/method_call_tree/version.rb

Constant Summary collapse

GET_ARGUMENTS =
"  method(__method__).parameters.map { |_t, v|\n    \"\#{v} = \#{eval(v.to_s).inspect}\"\n  }.join(', ')\n".freeze
SPACE_SIZE =
8
T_LINE =
'├─────'.freeze
I_LINE =
'│'.freeze
L_LINE =
'└─────'.freeze
VERSION =
'1.1.0'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MethodCallTree

Returns a new instance of MethodCallTree.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/method_call_tree.rb', line 19

def initialize(options)
  @args = options[:args]
  @tree = {}
  @queue = []

  tracer.enable { yield }

  @tree.each do |root, tree|
    walk(root, tree)
  end
end

Class Method Details

.create(options = {}, &block) ⇒ Object



15
16
17
# File 'lib/method_call_tree.rb', line 15

def self.create(options = {}, &block)
  new(options, &block)
end

Instance Method Details

#to_sObject



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

def to_s
  @queue.join
end