lib/trace_spy/method.rb
def current_arguments
      return {} unless @current_trace
      return {} if RAISE_EVENT.include?(@current_trace.event)

      extract_args(@current_trace)
    end
# Returns the arguments of the currently active trace
#
# @since 0.0.2
#
# @note
#   This method will attempt to avoid running in contexts where
#   argument retrieval will give a runtime error.
#
# @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_return do |m|
#       m.when(String) do |v|
#         binding.pry if spy.current_arguments[:a] == 'foo'
#       end
#     end
#   end
#   ```
#
#   It's meant to expose the current arguments present in a trace's
#   scope.
#
# @return [Hash[Symbol, Any]]
Returns the arguments of the currently active trace
Returns the arguments of the currently active trace
def current_arguments
      return {} unless @current_trace
      return {} if RAISE_EVENT.include?(@current_trace.event)
      extract_args(@current_trace)
    end
def current_arguments return { } unless @current_trace return { } if RAISE_EVENT . include? ( @current_trace . event ) extract_args ( @current_trace ) end
Returns the arguments of the currently active trace
Returns the arguments of the currently active trace
None
Hash[Symbol, Any
since
None
note
This method will attempt to avoid running in contexts where argument retrieval will give a runtime error.
This method will attempt to avoid running in contexts where argument retrieval will give a runtime error .
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_return do |m| m.when(String) do |v| binding.pry if spy.current_arguments[:a] == 'foo' end end end ``` It's meant to expose the current arguments present in a trace's scope.
This is a utility function for use with ` spy ` inside the matcher block . ` ` ` ruby trace_spy = TraceSpy :: Method . new ( : testing ) do |spy| spy . on_return do |m| m . when ( String ) do |v| binding . pry if spy . current_arguments [ : a ] == ' foo ' end end end ` ` ` It ' s meant to expose the current arguments present in a trace ' s scope .