Module: RSpec::Matchers::BuiltIn::BaseMatcher::HashFormatting Private

Included in:
RSpec::Matchers::BuiltIn::BaseMatcher
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/base_matcher.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.improve_hash_formatting(inspect_string) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

‘{ :a => 5, :b => 2 }.inspect` produces:

{:a=>5, :b=>2}

…but it looks much better as:

{:a => 5, :b => 2}

This is idempotent and safe to run on a string multiple times.



156
157
158
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/base_matcher.rb', line 156

def improve_hash_formatting(inspect_string)
  inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')
end