Module: RSpec::Matchers::BuiltIn::BaseMatcher::HashFormatting Private
Do not use. This module is for internal use only.
Class Method Summary
-
.improve_hash_formatting(inspect_string)
Internal use only
mod_func
‘{
:a
=> 5,:b
=> 2 }.inspect` produces:
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.
# 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