mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Rename the option from new_hash_syntax to colonize_symbol_keys
This commit is contained in:
parent
896e8f7d4e
commit
a4d960f1c8
4 changed files with 21 additions and 21 deletions
18
README.md
18
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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue