lib/trace_spy/method.rb
# Returns the local variables of the currently active trace
#
# @since 0.0.2
#
# @example
#   This is a utility function for use with `spy` inside the matcher
#   block.
#
#   ```ruby
#   trace_spy = TraceSpy::Method.new(:testing) do |spy|
#     spy.on_exception do |m|
#       m.when(RuntimeError) do |v|
#         p spy.current_local_variables
#       end
#     end
#   end
#   ```
#
#   It's meant to be used to expose the current local variables
#   within a trace's scope in any type of matcher.
#
# @return [Hash[Symbol, Any]]
Returns the local variables of the currently active trace
Returns the local variables of the currently active trace
def current_local_variables
      return {} unless @current_trace
      extract_locals(@current_trace)
    end
def current_local_variables return { } unless @current_trace extract_locals ( @current_trace ) end
Returns the local variables of the currently active trace
Returns the local variables of the currently active trace
None
Hash[Symbol, Any
since
None
example
This is a utility function for use with `spy` inside the matcher block. ```ruby trace_spy = TraceSpy::Method.new(:testing) do |spy| spy.on_exception do |m| m.when(RuntimeError) do |v| p spy.current_local_variables end end end ``` It's meant to be used to expose the current local variables within a trace's scope in any type of matcher.
This is a utility function for use with ` spy ` inside the matcher block . ` ` ` ruby trace_spy = TraceSpy :: Method . new ( : testing ) do |spy| spy . on_exception do |m| m . when ( RuntimeError ) do |v| p spy . current_local_variables end end end ` ` ` It ' s meant to be used to expose the current local variables within a trace ' s scope in any type of matcher .