module RSpec::Matchers::BuiltIn::BaseMatcher::HashFormatting

@private

Public Class Methods

‘{ :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.

# File rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb, line 138
def improve_hash_formatting(inspect_string)
  inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')
end