123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::Matchers::BaseMatcher::HashFormatting Private

Do not use. This module is for internal use only.

Class Method Summary

Class Method Details

.improve_hash_formatting(inspect_string) (mod_func)

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

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/matchers/base_matcher.rb', line 137

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