diff --git a/README.md b/README.md index f5e6f06..2d0e462 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,15 @@ ap object, options = {} Default options: ```ruby -:indent => 4, # Indent using 4 spaces. -:index => true, # Display array indices. -:html => false, # Use ANSI color codes rather than HTML. -:multiline => true, # Display in multiple lines. -:plain => false, # Use colors. -:raw => false, # Do not recursively format object instance variables. -:sort_keys => false, # Do not sort hash keys. -:limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer. -:new_hash_syntax => false, # Use the foo: 'bar' syntax, when the key is a symbol +:indent => 4, # Indent using 4 spaces. +:index => true, # Display array indices. +:html => false, # Use ANSI color codes rather than HTML. +:multiline => true, # Display in multiple lines. +:plain => false, # Use colors. +:raw => false, # Do not recursively format object instance variables. +:sort_keys => false, # Do not sort hash keys. +:limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer. +:colonize_symbol_keys => false, # Use the foo: 'bar' syntax, when the key is a symbol :color => { :args => :pale, :array => :white, diff --git a/lib/awesome_print/formatters/hash.rb b/lib/awesome_print/formatters/hash.rb index 217d0dc..cf99d3b 100644 --- a/lib/awesome_print/formatters/hash.rb +++ b/lib/awesome_print/formatters/hash.rb @@ -43,7 +43,7 @@ module AwesomePrint @data = @data.map do |key, value| formatter.indented do - if options[:new_hash_syntax] && is_a_symbol?(key) + if options[:colonize_symbol_keys] && is_a_symbol?(key) new_hash_syntax_format(key, value) else old_hash_syntax_format(key, value) diff --git a/lib/awesome_print/inspector.rb b/lib/awesome_print/inspector.rb index 94634a7..f900977 100644 --- a/lib/awesome_print/inspector.rb +++ b/lib/awesome_print/inspector.rb @@ -6,15 +6,15 @@ module AwesomePrint def initialize(options = {}) @options = { - :indent => 4, # Indent using 4 spaces. - :index => true, # Display array indices. - :html => false, # Use ANSI color codes rather than HTML. - :multiline => true, # Display in multiple lines. - :plain => false, # Use colors. - :raw => false, # Do not recursively format object instance variables. - :sort_keys => false, # Do not sort hash keys. - :limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer. - :new_hash_syntax => false, # Use the foo: 'bar' syntax, when the key is a symbol + :indent => 4, # Indent using 4 spaces. + :index => true, # Display array indices. + :html => false, # Use ANSI color codes rather than HTML. + :multiline => true, # Display in multiple lines. + :plain => false, # Use colors. + :raw => false, # Do not recursively format object instance variables. + :sort_keys => false, # Do not sort hash keys. + :limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer. + :colonize_symbol_keys => false, # Use the foo: 'bar' syntax, when the key is a symbol :color => { :args => :pale, :array => :white, diff --git a/spec/formats_spec.rb b/spec/formats_spec.rb index cf76cb6..83a5124 100644 --- a/spec/formats_spec.rb +++ b/spec/formats_spec.rb @@ -276,7 +276,7 @@ EOS end it "new hash syntax" do - expect(@hash.ai(:plain => true, :new_hash_syntax => true)).to eq <<-EOS.strip + expect(@hash.ai(:plain => true, :colonize_symbol_keys => true)).to eq <<-EOS.strip { 1 => { sym: { @@ -330,7 +330,7 @@ EOS end it "colored with new hash syntax" do - expect(@hash.ai(:new_hash_syntax => true)).to eq <<-EOS.strip + expect(@hash.ai(:colonize_symbol_keys => true)).to eq <<-EOS.strip { 1\e[0;37m => \e[0m{ sym\e[0;37m: \e[0m{