lib/rspec/matchers/composable.rb
def surface_descriptions_in(item)
        if Matchers.is_a_describable_matcher?(item)
          DescribableItem.new(item)
        elsif Hash === item
          Hash[surface_descriptions_in(item.to_a)]
        elsif Struct === item || unreadable_io?(item)
          RSpec::Support::ObjectFormatter.format(item)
        elsif should_enumerate?(item)
          item.map { |subitem| surface_descriptions_in(subitem) }
        else
          item
        end
      end
# Transforms the given data structue (typically a hash or array)
# into a new data structure that, when `#inspect` is called on it,
# will provide descriptions of any contained matchers rather than
# the normal `#inspect` output.
#
# You are encouraged to use this in your custom matcher's
# `description`, `failure_message` or
# `failure_message_when_negated` implementation if you are
# supporting any arguments which may be a data structure
# containing matchers.
#
# @!visibility public
Transforms the given data structue (typically a hash or array)
into a new data structure that, when `#inspect` is called on it,
will provide descriptions of any contained matchers rather than
the normal `#inspect` output.


Transforms the given data structue ( typically a hash or array ) into a new data structure that when ` #inspect ` is called on it will provide descriptions of any contained matchers rather than the normal ` #inspect ` output .
def surface_descriptions_in(item)
        if Matchers.is_a_describable_matcher?(item)
          DescribableItem.new(item)
        elsif Hash === item
          Hash[surface_descriptions_in(item.to_a)]
        elsif Struct === item || unreadable_io?(item)
          RSpec::Support::ObjectFormatter.format(item)
        elsif should_enumerate?(item)
          item.map { |subitem| surface_descriptions_in(subitem) }
        else
          item
        end
      end
def surface_descriptions_in ( item ) if Matchers . is_a_describable_matcher? ( item ) DescribableItem . new ( item ) elsif Hash === item Hash [ surface_descriptions_in ( item . to_a ) ] elsif Struct === item || unreadable_io? ( item ) RSpec :: Support :: ObjectFormatter . format ( item ) elsif should_enumerate? ( item ) item . map { | subitem | surface_descriptions_in ( subitem ) } else item end end
Transforms the given data structue (typically a hash or array)
into a new data structure that, when `#inspect` is called on it,
will provide descriptions of any contained matchers rather than
the normal `#inspect` output.
Transforms the given data structue ( typically a hash or array ) into a new data structure that when ` #inspect ` is called on it will provide descriptions of any contained matchers rather than the normal ` #inspect ` output .
item
!visibility
None