Class: UML::HighlevelBacktracer

Inherits:
AspectR::Aspect
  • Object
show all
Includes:
MethodHelper, Observable
Defined in:
lib/uml/highlevel_backtracer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHighlevelBacktracer



22
23
24
25
# File 'lib/uml/highlevel_backtracer.rb', line 22

def initialize
  
  @call_stack = []
end

Instance Attribute Details

#call_stackObject (readonly)

call_stack is an array with hashes as elements. Each element represents a call to a wrapped method with topmost element at last.

Element has following keys as symbols:

args

holds an array of the arguments to method

object

reference to receiver of method

method_symbol

symbol of called method

real_object

the real receiver of method in inheritance tree

returns

return value of method. Only valid if method returned already



20
21
22
# File 'lib/uml/highlevel_backtracer.rb', line 20

def call_stack
  @call_stack
end

Instance Method Details

#include(klass, *methods) ⇒ Object

Wrap given methods of class or instance.

each wrapped method will notify observers with (symbol, self) where symbol can be :call or :return



31
32
33
34
35
36
# File 'lib/uml/highlevel_backtracer.rb', line 31

def include(klass, *methods)
  methods.each do |method_symbol|
    add_advice klass, PRE, method_symbol, :before
    add_advice klass, POST, method_symbol, :after
  end
end