Class: Callstacking::Rails::Spans
- Inherits:
-
Object
- Object
- Callstacking::Rails::Spans
- Defined in:
- lib/callstacking/rails/spans.rb
Instance Attribute Summary collapse
-
#call_entry_callback ⇒ Object
Returns the value of attribute call_entry_callback.
-
#call_return_callback ⇒ Object
Returns the value of attribute call_return_callback.
-
#nesting_level ⇒ Object
Returns the value of attribute nesting_level.
-
#order_num ⇒ Object
Returns the value of attribute order_num.
-
#previous_entry ⇒ Object
Returns the value of attribute previous_entry.
Instance Method Summary collapse
- #call_entry(klass, method_name, arguments, path, line_no, method_source) ⇒ Object
- #call_return(klass, method_name, path, line_no, return_val, method_source) ⇒ Object
- #increment_nesting_level ⇒ Object
- #increment_order_num ⇒ Object
-
#initialize ⇒ Spans
constructor
A new instance of Spans.
- #on_call_entry(&block) ⇒ Object
- #on_call_return(&block) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Spans
Returns a new instance of Spans.
7 8 9 |
# File 'lib/callstacking/rails/spans.rb', line 7 def initialize reset end |
Instance Attribute Details
#call_entry_callback ⇒ Object
Returns the value of attribute call_entry_callback.
5 6 7 |
# File 'lib/callstacking/rails/spans.rb', line 5 def call_entry_callback @call_entry_callback end |
#call_return_callback ⇒ Object
Returns the value of attribute call_return_callback.
5 6 7 |
# File 'lib/callstacking/rails/spans.rb', line 5 def call_return_callback @call_return_callback end |
#nesting_level ⇒ Object
Returns the value of attribute nesting_level.
4 5 6 |
# File 'lib/callstacking/rails/spans.rb', line 4 def nesting_level @nesting_level end |
#order_num ⇒ Object
Returns the value of attribute order_num.
4 5 6 |
# File 'lib/callstacking/rails/spans.rb', line 4 def order_num @order_num end |
#previous_entry ⇒ Object
Returns the value of attribute previous_entry.
4 5 6 |
# File 'lib/callstacking/rails/spans.rb', line 4 def previous_entry @previous_entry end |
Instance Method Details
#call_entry(klass, method_name, arguments, path, line_no, method_source) ⇒ Object
21 22 23 24 25 |
# File 'lib/callstacking/rails/spans.rb', line 21 def call_entry(klass, method_name, arguments, path, line_no, method_source) @nesting_level+=1 @previous_entry = previous_event(klass, method_name) @call_entry_callback.call(@nesting_level, increment_order_num, klass, method_name, arguments, path, line_no, method_source) end |
#call_return(klass, method_name, path, line_no, return_val, method_source) ⇒ Object
27 28 29 30 31 |
# File 'lib/callstacking/rails/spans.rb', line 27 def call_return(klass, method_name, path, line_no, return_val, method_source) @call_return_callback.call(coupled_callee(klass, method_name), @nesting_level, increment_order_num, klass, method_name, path, line_no, return_val, method_source) @nesting_level-=1 end |
#increment_nesting_level ⇒ Object
16 17 18 19 |
# File 'lib/callstacking/rails/spans.rb', line 16 def increment_nesting_level @nesting_level+=1 @nesting_level end |
#increment_order_num ⇒ Object
11 12 13 14 |
# File 'lib/callstacking/rails/spans.rb', line 11 def increment_order_num @order_num+=1 @order_num end |
#on_call_entry(&block) ⇒ Object
33 34 35 |
# File 'lib/callstacking/rails/spans.rb', line 33 def on_call_entry(&block) @call_entry_callback = block end |
#on_call_return(&block) ⇒ Object
37 38 39 |
# File 'lib/callstacking/rails/spans.rb', line 37 def on_call_return(&block) @call_return_callback = block end |
#reset ⇒ Object
41 42 43 44 45 |
# File 'lib/callstacking/rails/spans.rb', line 41 def reset @nesting_level = -1 @order_num = -1 @previous_entry = nil end |