Class: TraceableObject
- Inherits:
-
Object
show all
- Defined in:
- lib/core/traceable_object.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TraceableObject.
3
4
5
|
# File 'lib/core/traceable_object.rb', line 3
def initialize(obj)
@obj = obj
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
32
33
34
35
36
|
# File 'lib/core/traceable_object.rb', line 32
def method_missing(sym, *args, &block)
before_trace(sym)
@obj.send sym, *args, &block
after_trace(sym)
end
|
Class Method Details
.after_init(classname) ⇒ Object
11
12
13
14
|
# File 'lib/core/traceable_object.rb', line 11
def self.after_init(classname)
puts "-- f - #{classname}.initialize() ---"
end
|
.after_trace(className, sym) ⇒ Object
28
29
30
|
# File 'lib/core/traceable_object.rb', line 28
def self.after_trace(className, sym)
puts "-- f - #{className}::#{sym}() ---"
end
|
.before_init(classname) ⇒ Object
7
8
9
|
# File 'lib/core/traceable_object.rb', line 7
def self.before_init(classname)
puts "-- s - #{classname}.initialize() ---"
end
|
.before_trace(className, sym) ⇒ Object
24
25
26
|
# File 'lib/core/traceable_object.rb', line 24
def self.before_trace(className, sym)
puts "-- s - #{className}::#{sym}() ---"
end
|
.call_class_method(className, sym, *args, &block) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/core/traceable_object.rb', line 38
def self.call_class_method(className, sym, *args, &block)
self.before_trace(className, sym) if Rcli.trace_app
retval = Object.const_get( className ).send sym, *args, &block
self.after_trace(className, sym) if Rcli.trace_app
retval
end
|
Instance Method Details
#after_trace(sym) ⇒ Object
20
21
22
|
# File 'lib/core/traceable_object.rb', line 20
def after_trace(sym)
puts "-- f - #{@obj.class}.#{sym}() ---"
end
|
#before_trace(sym) ⇒ Object
16
17
18
|
# File 'lib/core/traceable_object.rb', line 16
def before_trace(sym)
puts "-- s - #{@obj.class}.#{sym}() ---"
end
|