Class: Delfos::MethodLogging::CallSiteParsing
- Inherits:
-
Object
- Object
- Delfos::MethodLogging::CallSiteParsing
- Defined in:
- lib/delfos/method_logging/call_site_parsing.rb
Constant Summary collapse
- STACK_OFFSET =
This magic number is based on the implementation within this file. If the line with ‘call_site_binding.of_caller(stack_index + STACK_OFFSET).receiver` is moved up or down the call stack a test fails and we have to change `STACK_OFFSET`
5
Instance Attribute Summary collapse
-
#call_site_binding ⇒ Object
readonly
Returns the value of attribute call_site_binding.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#initialize(stack, call_site_binding, stack_offset: nil) ⇒ CallSiteParsing
constructor
A new instance of CallSiteParsing.
- #perform ⇒ Object
Constructor Details
#initialize(stack, call_site_binding, stack_offset: nil) ⇒ CallSiteParsing
Returns a new instance of CallSiteParsing.
14 15 16 17 18 |
# File 'lib/delfos/method_logging/call_site_parsing.rb', line 14 def initialize(stack, call_site_binding, stack_offset: nil) @stack = stack @call_site_binding = call_site_binding @stack_offset = stack_offset end |
Instance Attribute Details
#call_site_binding ⇒ Object (readonly)
Returns the value of attribute call_site_binding.
12 13 14 |
# File 'lib/delfos/method_logging/call_site_parsing.rb', line 12 def call_site_binding @call_site_binding end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
12 13 14 |
# File 'lib/delfos/method_logging/call_site_parsing.rb', line 12 def stack @stack end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/delfos/method_logging/call_site_parsing.rb', line 20 def perform file, line_number, method_name = method_details return unless current && file && line_number && method_name CodeLocation.new(object: object, method_name: method_name.to_s, class_method: class_method, file: file, line_number: line_number) end |