Module: ProxyPacRb::RSpecMatchers::BaseMatcher::HashFormatting Private

Included in:
ProxyPacRb::RSpecMatchers::BaseMatcher
Defined in:
lib/proxy_pac_rb/rspec/matchers/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.



139
140
141
# File 'lib/proxy_pac_rb/rspec/matchers/base_matcher.rb', line 139

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