amazing_print 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Appraisals +47 -51
  4. data/CHANGELOG.md +32 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE +1 -0
  7. data/README.md +20 -13
  8. data/Rakefile +2 -0
  9. data/lib/amazing_print.rb +19 -17
  10. data/lib/amazing_print/colorize.rb +2 -0
  11. data/lib/amazing_print/core_ext/awesome_method_array.rb +3 -1
  12. data/lib/amazing_print/core_ext/class.rb +2 -0
  13. data/lib/amazing_print/core_ext/kernel.rb +2 -0
  14. data/lib/amazing_print/core_ext/logger.rb +11 -2
  15. data/lib/amazing_print/core_ext/object.rb +2 -0
  16. data/lib/amazing_print/core_ext/string.rb +5 -2
  17. data/lib/amazing_print/custom_defaults.rb +3 -1
  18. data/lib/amazing_print/ext/action_view.rb +3 -1
  19. data/lib/amazing_print/ext/active_record.rb +9 -18
  20. data/lib/amazing_print/ext/active_support.rb +2 -0
  21. data/lib/amazing_print/ext/mongo_mapper.rb +4 -2
  22. data/lib/amazing_print/ext/mongoid.rb +2 -0
  23. data/lib/amazing_print/ext/nobrainer.rb +6 -0
  24. data/lib/amazing_print/ext/nokogiri.rb +2 -0
  25. data/lib/amazing_print/ext/ostruct.rb +2 -0
  26. data/lib/amazing_print/ext/ripple.rb +2 -0
  27. data/lib/amazing_print/ext/sequel.rb +4 -2
  28. data/lib/amazing_print/formatter.rb +9 -2
  29. data/lib/amazing_print/formatters.rb +12 -10
  30. data/lib/amazing_print/formatters/array_formatter.rb +3 -1
  31. data/lib/amazing_print/formatters/base_formatter.rb +5 -2
  32. data/lib/amazing_print/formatters/class_formatter.rb +2 -0
  33. data/lib/amazing_print/formatters/dir_formatter.rb +4 -1
  34. data/lib/amazing_print/formatters/file_formatter.rb +4 -1
  35. data/lib/amazing_print/formatters/hash_formatter.rb +4 -2
  36. data/lib/amazing_print/formatters/method_formatter.rb +2 -0
  37. data/lib/amazing_print/formatters/object_formatter.rb +14 -13
  38. data/lib/amazing_print/formatters/simple_formatter.rb +2 -0
  39. data/lib/amazing_print/formatters/struct_formatter.rb +9 -7
  40. data/lib/amazing_print/indentator.rb +2 -0
  41. data/lib/amazing_print/inspector.rb +9 -9
  42. data/lib/amazing_print/version.rb +3 -1
  43. data/lib/ap.rb +3 -1
  44. data/spec/active_record_helper.rb +10 -0
  45. data/spec/colors_spec.rb +43 -46
  46. data/spec/core_ext/logger_spec.rb +40 -14
  47. data/spec/core_ext/string_spec.rb +2 -7
  48. data/spec/ext/action_controller_spec.rb +40 -0
  49. data/spec/ext/action_view_spec.rb +8 -1
  50. data/spec/ext/active_model_spec.rb +37 -0
  51. data/spec/ext/active_record_spec.rb +42 -7
  52. data/spec/ext/active_support_spec.rb +12 -1
  53. data/spec/ext/mongo_mapper_spec.rb +8 -6
  54. data/spec/ext/mongoid_spec.rb +2 -0
  55. data/spec/ext/nobrainer_spec.rb +2 -0
  56. data/spec/ext/nokogiri_spec.rb +2 -0
  57. data/spec/ext/ostruct_spec.rb +2 -0
  58. data/spec/ext/ripple_spec.rb +2 -0
  59. data/spec/ext/sequel_spec.rb +45 -0
  60. data/spec/formats_spec.rb +10 -8
  61. data/spec/methods_spec.rb +37 -3
  62. data/spec/misc_spec.rb +3 -1
  63. data/spec/objects_spec.rb +2 -0
  64. data/spec/sequel_helper.rb +18 -0
  65. data/spec/spec_helper.rb +5 -1
  66. data/spec/support/active_record_data.rb +2 -0
  67. data/spec/support/active_record_data/6_1_diana.txt +109 -0
  68. data/spec/support/active_record_data/6_1_multi.txt +220 -0
  69. data/spec/support/ext_verifier.rb +9 -4
  70. data/spec/support/mongoid_versions.rb +2 -0
  71. data/spec/support/rails_versions.rb +7 -0
  72. metadata +79 -54
  73. data/lib/amazing_print/core_ext/method.rb +0 -21
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -53,7 +55,7 @@ module AmazingPrint
53
55
  end
54
56
  end
55
57
  end
56
- "#{object} " << awesome_hash(data)
58
+ [awesome_simple(object.to_s, :active_record_instance), awesome_hash(data)].join(' ')
57
59
  end
58
60
 
59
61
  # Format ActiveRecord class object.
@@ -70,10 +72,7 @@ module AmazingPrint
70
72
  hash[c.name.to_sym] = c.type
71
73
  end
72
74
 
73
- name = "class #{awesome_simple(object.to_s, :class)}"
74
- base = "< #{awesome_simple(object.superclass.to_s, :class)}"
75
-
76
- [name, base, awesome_hash(data)].join(' ')
75
+ [awesome_simple("class #{object} < #{object.superclass}", :class), awesome_hash(data)].join(' ')
77
76
  end
78
77
 
79
78
  # Format ActiveModel error object.
@@ -82,20 +81,12 @@ module AmazingPrint
82
81
  return object.inspect unless defined?(::ActiveSupport::OrderedHash)
83
82
  return awesome_object(object) if @options[:raw]
84
83
 
85
- object_dump = object.marshal_dump.first
86
- data = if object_dump.class.column_names != object_dump.attributes.keys
87
- object_dump.attributes
88
- else
89
- object_dump.class.column_names.each_with_object(::ActiveSupport::OrderedHash.new) do |name, hash|
90
- if object_dump.has_attribute?(name) || object_dump.new_record?
91
- value = object_dump.respond_to?(name) ? object_dump.send(name) : object_dump.read_attribute(name)
92
- hash[name.to_sym] = value
93
- end
94
- end
95
- end
84
+ data = object.instance_variable_get('@base')
85
+ .attributes
86
+ .merge(details: object.details.to_h,
87
+ messages: object.messages.to_h.transform_values(&:to_a))
96
88
 
97
- data.merge!({ details: object.details, messages: object.messages })
98
- "#{object} " << awesome_hash(data)
89
+ [awesome_simple(object.to_s, :active_model_error), awesome_hash(data)].join(' ')
99
90
  end
100
91
  end
101
92
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -17,7 +19,7 @@ module AmazingPrint
17
19
  cast = cast_without_mongo_mapper(object, type)
18
20
 
19
21
  if defined?(::MongoMapper::Document)
20
- if object.is_a?(Class) && (object.ancestors & [::MongoMapper::Document, ::MongoMapper::EmbeddedDocument]).size > 0
22
+ if object.is_a?(Class) && !(object.ancestors & [::MongoMapper::Document, ::MongoMapper::EmbeddedDocument]).empty?
21
23
  cast = :mongo_mapper_class
22
24
  elsif object.is_a?(::MongoMapper::Document) || object.is_a?(::MongoMapper::EmbeddedDocument)
23
25
  cast = :mongo_mapper_instance
@@ -88,7 +90,7 @@ module AmazingPrint
88
90
  label = "#{colorize('embedded', :assoc)} #{label}"
89
91
  end
90
92
 
91
- "#{label} " << awesome_hash(data)
93
+ [label, awesome_hash(data)].join(' ')
92
94
  end
93
95
 
94
96
  # Format MongoMapper association object.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Style/HashTransformValues
4
+
1
5
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
6
  #
3
7
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -51,3 +55,5 @@ module AmazingPrint
51
55
  end
52
56
 
53
57
  AmazingPrint::Formatter.include AmazingPrint::NoBrainer
58
+
59
+ # rubocop:enable Style/HashTransformValues
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -16,7 +18,7 @@ module AmazingPrint
16
18
  cast = cast_without_sequel(object, type)
17
19
  if defined?(::Sequel::Model) && object.is_a?(::Sequel::Model)
18
20
  cast = :sequel_document
19
- elsif defined?(::Sequel::Model) && object.is_a?(Class) && object.ancestors.include?(::Sequel::Model)
21
+ elsif defined?(::Sequel::Model) && object.is_a?(Class) && object.ancestors.include?(::Sequel::Model) && object&.name != 'Sequel::Model'
20
22
  cast = :sequel_model_class
21
23
  elsif defined?(::Sequel::Mysql2::Dataset) && object.class.ancestors.include?(::Sequel::Mysql2::Dataset)
22
24
  cast = :sequel_dataset
@@ -27,7 +29,7 @@ module AmazingPrint
27
29
  # Format Sequel Document object.
28
30
  #------------------------------------------------------------------------------
29
31
  def awesome_sequel_document(object)
30
- data = object.values.sort_by { |key| key.to_s }.each_with_object({}) do |c, hash|
32
+ data = object.values.sort_by(&:to_s).each_with_object({}) do |c, hash|
31
33
  hash[c[0].to_sym] = c[1]
32
34
  end
33
35
  data = { errors: object.errors, values: data } unless object.errors.empty?
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
4
6
  # See LICENSE file or http://www.opensource.org/licenses/mit-license.php
5
7
  #------------------------------------------------------------------------------
6
- require 'amazing_print/formatters'
8
+ require_relative 'formatters'
7
9
 
8
10
  module AmazingPrint
9
11
  class Formatter
@@ -26,7 +28,7 @@ module AmazingPrint
26
28
  send(:"awesome_#{core_class}", object) # Core formatters.
27
29
  else
28
30
  awesome_self(object, type) # Catch all that falls back to object.inspect.
29
- end
31
+ end
30
32
  awesome
31
33
  end
32
34
 
@@ -111,6 +113,11 @@ module AmazingPrint
111
113
 
112
114
  return nil if object.method(:to_hash).arity != 0
113
115
 
116
+ # ActionController::Parameters will raise if they are not yet permitted and
117
+ # we try to convert to hash.
118
+ # https://api.rubyonrails.org/classes/ActionController/Parameters.html
119
+ return nil if object.respond_to?(:permitted?) && !object.permitted?
120
+
114
121
  hash = object.to_hash
115
122
  return nil if !hash.respond_to?(:keys) || !hash.respond_to?(:[])
116
123
 
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AmazingPrint
2
4
  module Formatters
3
- require 'amazing_print/formatters/object_formatter'
4
- require 'amazing_print/formatters/struct_formatter'
5
- require 'amazing_print/formatters/hash_formatter'
6
- require 'amazing_print/formatters/array_formatter'
7
- require 'amazing_print/formatters/simple_formatter'
8
- require 'amazing_print/formatters/method_formatter'
9
- require 'amazing_print/formatters/class_formatter'
10
- require 'amazing_print/formatters/dir_formatter'
11
- require 'amazing_print/formatters/file_formatter'
12
- require 'amazing_print/colorize'
5
+ require_relative 'formatters/object_formatter'
6
+ require_relative 'formatters/struct_formatter'
7
+ require_relative 'formatters/hash_formatter'
8
+ require_relative 'formatters/array_formatter'
9
+ require_relative 'formatters/simple_formatter'
10
+ require_relative 'formatters/method_formatter'
11
+ require_relative 'formatters/class_formatter'
12
+ require_relative 'formatters/dir_formatter'
13
+ require_relative 'formatters/file_formatter'
14
+ require_relative 'colorize'
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -31,7 +33,7 @@ module AmazingPrint
31
33
  if options[:multiline]
32
34
  multiline_array
33
35
  else
34
- '[ ' << array.map { |item| inspector.awesome(item) }.join(', ') << ' ]'
36
+ '[ ' + array.map { |item| inspector.awesome(item) }.join(', ') + ' ]'
35
37
  end
36
38
  end
37
39
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../colorize'
2
4
 
3
5
  module AmazingPrint
@@ -70,6 +72,8 @@ module AmazingPrint
70
72
  name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
71
73
  arr << case type
72
74
  when :req then name.to_s
75
+ when :keyreq then "#{name}:"
76
+ when :key then "*#{name}:"
73
77
  when :opt, :rest then "*#{name}"
74
78
  when :block then "&#{name}"
75
79
  else '?'
@@ -91,7 +95,7 @@ module AmazingPrint
91
95
  # #<UnboundMethod: Hello#world>
92
96
  # #<UnboundMethod: Hello#world() /home/hs/code/amazing_print/spec/methods_spec.rb:68>
93
97
  #
94
- if method.to_s =~ /(Unbound)*Method: ((#<)?[^\/#]*)[#\.]/
98
+ if method.to_s =~ %r{(Unbound)*Method: ((#<)?[^/#]*)[#\.]}
95
99
  unbound = Regexp.last_match(1) && '(unbound)'
96
100
  klass = Regexp.last_match(2)
97
101
  if klass && klass =~ /(\(\w+:\s.*?\))/ # Is this ActiveRecord-style class?
@@ -123,7 +127,6 @@ module AmazingPrint
123
127
  end
124
128
 
125
129
  def outdent
126
- ' ' * (indentation - options[:indent].abs)
127
130
  i = indentation - options[:indent].abs
128
131
 
129
132
  INDENT_CACHE[i] || ' ' * i
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -1,6 +1,9 @@
1
- require_relative 'base_formatter'
1
+ # frozen_string_literal: true
2
+
2
3
  require 'shellwords'
3
4
 
5
+ require_relative 'base_formatter'
6
+
4
7
  module AmazingPrint
5
8
  module Formatters
6
9
  class DirFormatter < BaseFormatter
@@ -1,6 +1,9 @@
1
- require_relative 'base_formatter'
1
+ # frozen_string_literal: true
2
+
2
3
  require 'shellwords'
3
4
 
5
+ require_relative 'base_formatter'
6
+
4
7
  module AmazingPrint
5
8
  module Formatters
6
9
  class FileFormatter < BaseFormatter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -84,11 +86,11 @@ module AmazingPrint
84
86
 
85
87
  def ruby19_syntax(key, value, width)
86
88
  key[0] = ''
87
- align(key, width - 1) << colorize(': ', :hash) << inspector.awesome(value)
89
+ "#{align(key, width - 1)}#{colorize(': ', :hash)}#{inspector.awesome(value)}"
88
90
  end
89
91
 
90
92
  def pre_ruby19_syntax(key, value, width)
91
- align(key, width) << colorize(' => ', :hash) << inspector.awesome(value)
93
+ "#{align(key, width)}#{colorize(' => ', :hash)}#{inspector.awesome(value)}"
92
94
  end
93
95
 
94
96
  def plain_single_line
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -19,7 +21,7 @@ module AmazingPrint
19
21
  object.respond_to?(property) ? :accessor : :writer
20
22
  else
21
23
  object.respond_to?(property) ? :reader : nil
22
- end
24
+ end
23
25
  if accessor
24
26
  ["attr_#{accessor} :#{property}", var]
25
27
  else
@@ -33,15 +35,15 @@ module AmazingPrint
33
35
  end
34
36
 
35
37
  unless options[:plain]
36
- if key =~ /(@\w+)/
37
- key.sub!(Regexp.last_match(1), colorize(Regexp.last_match(1), :variable))
38
- else
39
- key.sub!(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
40
- end
38
+ key = if key =~ /(@\w+)/
39
+ key.sub(Regexp.last_match(1), colorize(Regexp.last_match(1), :variable))
40
+ else
41
+ key.sub(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
42
+ end
41
43
  end
42
44
 
43
45
  indented do
44
- key << colorize(' = ', :hash) + inspector.awesome(object.instance_variable_get(var))
46
+ key + colorize(' = ', :hash) + inspector.awesome(object.instance_variable_get(var))
45
47
  end
46
48
  end
47
49
 
@@ -60,14 +62,13 @@ module AmazingPrint
60
62
 
61
63
  def awesome_instance
62
64
  str = object.send(options[:class_name]).to_s
63
- # We need to ensure that the original Kernel#format is used here instead of the one defined
64
- # above.
65
+ return str unless options[:object_id]
66
+
67
+ # We need to ensure that the original Kernel#format is used here instead of the one
68
+ # defined above.
65
69
  # rubocop:disable Style/ColonMethodCall
66
- if options[:object_id]
67
- str << Kernel::format(':0x%08x', (object.__id__ * 2))
68
- end
70
+ str + Kernel::format(':0x%08x', (object.__id__ * 2))
69
71
  # rubocop:enable Style/ColonMethodCall
70
- str
71
72
  end
72
73
 
73
74
  def left_aligned
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -19,7 +21,7 @@ module AmazingPrint
19
21
  struct.respond_to?(property) ? :accessor : :writer
20
22
  else
21
23
  struct.respond_to?(property) ? :reader : nil
22
- end
24
+ end
23
25
  if accessor
24
26
  ["attr_#{accessor} :#{property}", var]
25
27
  else
@@ -33,15 +35,15 @@ module AmazingPrint
33
35
  end
34
36
 
35
37
  unless options[:plain]
36
- if key =~ /(@\w+)/
37
- key.sub!(Regexp.last_match(1), colorize(Regexp.last_match(1), :variable))
38
- else
39
- key.sub!(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
40
- end
38
+ key = if key =~ /(@\w+)/
39
+ key.sub(Regexp.last_match(1), colorize(Regexp.last_match(1), :variable))
40
+ else
41
+ key.sub(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
42
+ end
41
43
  end
42
44
 
43
45
  indented do
44
- key << colorize(' = ', :hash) + inspector.awesome(struct.send(var))
46
+ key + colorize(' = ', :hash) + inspector.awesome(struct.send(var))
45
47
  end
46
48
  end
47
49
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AmazingPrint
2
4
  class Indentator
3
5
  attr_reader :shift_width, :indentation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
4
  #
3
5
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -26,7 +28,7 @@ module AmazingPrint
26
28
  class_name: :class, # Method used to get Instance class name.
27
29
  object_id: true, # Show object_id.
28
30
  color: {
29
- args: :pale,
31
+ args: :whiteish,
30
32
  array: :white,
31
33
  bigdecimal: :blue,
32
34
  class: :yellow,
@@ -35,13 +37,13 @@ module AmazingPrint
35
37
  fixnum: :blue,
36
38
  integer: :blue,
37
39
  float: :blue,
38
- hash: :pale,
40
+ hash: :whiteish,
39
41
  keyword: :cyan,
40
42
  method: :purpleish,
41
43
  nilclass: :red,
42
44
  rational: :blue,
43
45
  string: :yellowish,
44
- struct: :pale,
46
+ struct: :whiteish,
45
47
  symbol: :cyanish,
46
48
  time: :greenish,
47
49
  trueclass: :green,
@@ -86,10 +88,10 @@ module AmazingPrint
86
88
  def colorize?
87
89
  AmazingPrint.force_colors ||= false
88
90
  AmazingPrint.force_colors || (
89
- if defined? @colorize_STDOUT
90
- @colorize_STDOUT
91
+ if defined? @colorize_stdout
92
+ @colorize_stdout
91
93
  else
92
- @colorize_STDOUT = STDOUT.tty? && (
94
+ @colorize_stdout = STDOUT.tty? && (
93
95
  (
94
96
  ENV['TERM'] &&
95
97
  ENV['TERM'] != 'dumb'
@@ -165,9 +167,7 @@ module AmazingPrint
165
167
  #---------------------------------------------------------------------------
166
168
  def merge_custom_defaults!
167
169
  load_dotfile
168
- if AmazingPrint.defaults.is_a?(Hash)
169
- merge_options!(AmazingPrint.defaults)
170
- end
170
+ merge_options!(AmazingPrint.defaults) if AmazingPrint.defaults.is_a?(Hash)
171
171
  rescue StandardError => e
172
172
  warn "Could not load '.aprc' from ENV['HOME']: #{e}"
173
173
  end