amazing_print 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -0
  5. data/Rakefile +2 -0
  6. data/lib/amazing_print.rb +3 -1
  7. data/lib/amazing_print/colorize.rb +2 -0
  8. data/lib/amazing_print/core_ext/awesome_method_array.rb +3 -1
  9. data/lib/amazing_print/core_ext/class.rb +2 -0
  10. data/lib/amazing_print/core_ext/kernel.rb +2 -0
  11. data/lib/amazing_print/core_ext/logger.rb +2 -0
  12. data/lib/amazing_print/core_ext/object.rb +2 -0
  13. data/lib/amazing_print/core_ext/string.rb +5 -2
  14. data/lib/amazing_print/custom_defaults.rb +2 -0
  15. data/lib/amazing_print/ext/action_view.rb +2 -0
  16. data/lib/amazing_print/ext/active_record.rb +3 -1
  17. data/lib/amazing_print/ext/active_support.rb +2 -0
  18. data/lib/amazing_print/ext/mongo_mapper.rb +3 -1
  19. data/lib/amazing_print/ext/mongoid.rb +2 -0
  20. data/lib/amazing_print/ext/nobrainer.rb +2 -0
  21. data/lib/amazing_print/ext/nokogiri.rb +2 -0
  22. data/lib/amazing_print/ext/ostruct.rb +2 -0
  23. data/lib/amazing_print/ext/ripple.rb +2 -0
  24. data/lib/amazing_print/ext/sequel.rb +4 -2
  25. data/lib/amazing_print/formatter.rb +7 -0
  26. data/lib/amazing_print/formatters.rb +2 -0
  27. data/lib/amazing_print/formatters/array_formatter.rb +3 -1
  28. data/lib/amazing_print/formatters/base_formatter.rb +3 -1
  29. data/lib/amazing_print/formatters/class_formatter.rb +2 -0
  30. data/lib/amazing_print/formatters/dir_formatter.rb +2 -0
  31. data/lib/amazing_print/formatters/file_formatter.rb +2 -0
  32. data/lib/amazing_print/formatters/hash_formatter.rb +3 -1
  33. data/lib/amazing_print/formatters/method_formatter.rb +2 -0
  34. data/lib/amazing_print/formatters/object_formatter.rb +13 -12
  35. data/lib/amazing_print/formatters/simple_formatter.rb +2 -0
  36. data/lib/amazing_print/formatters/struct_formatter.rb +8 -6
  37. data/lib/amazing_print/indentator.rb +2 -0
  38. data/lib/amazing_print/inspector.rb +9 -9
  39. data/lib/amazing_print/version.rb +3 -1
  40. data/lib/ap.rb +2 -0
  41. data/spec/active_record_helper.rb +2 -0
  42. data/spec/colors_spec.rb +11 -2
  43. data/spec/core_ext/logger_spec.rb +2 -0
  44. data/spec/core_ext/string_spec.rb +2 -7
  45. data/spec/ext/action_controller_spec.rb +40 -0
  46. data/spec/ext/action_view_spec.rb +2 -0
  47. data/spec/ext/active_record_spec.rb +7 -5
  48. data/spec/ext/active_support_spec.rb +2 -0
  49. data/spec/ext/mongo_mapper_spec.rb +6 -4
  50. data/spec/ext/mongoid_spec.rb +2 -0
  51. data/spec/ext/nobrainer_spec.rb +2 -0
  52. data/spec/ext/nokogiri_spec.rb +2 -0
  53. data/spec/ext/ostruct_spec.rb +2 -0
  54. data/spec/ext/ripple_spec.rb +2 -0
  55. data/spec/ext/sequel_spec.rb +29 -27
  56. data/spec/formats_spec.rb +10 -8
  57. data/spec/methods_spec.rb +5 -3
  58. data/spec/misc_spec.rb +3 -1
  59. data/spec/objects_spec.rb +2 -0
  60. data/spec/sequel_helper.rb +2 -0
  61. data/spec/spec_helper.rb +4 -1
  62. data/spec/support/active_record_data.rb +2 -0
  63. data/spec/support/ext_verifier.rb +2 -0
  64. data/spec/support/mongoid_versions.rb +2 -0
  65. data/spec/support/rails_versions.rb +2 -0
  66. metadata +56 -41
  67. data/lib/amazing_print/core_ext/method.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c49ac51983ec5dc57570bb8e77591c4aa837da01afec64fe9d62139f296ac42b
4
- data.tar.gz: c1145227423a78c989a8d9a49f8e3ab33b8a39c33b3a197e16a3353300ed20dd
3
+ metadata.gz: 831dcabef8a04de7ce8342167146dc8ab32017b74d4edd59cb195a151f7da935
4
+ data.tar.gz: 4ee631f2582a834a7cf729cc183da2f9473fb8c3fd77ba176eaf731722b7a626
5
5
  SHA512:
6
- metadata.gz: b0039aa9251d996bb7fa516b33ebfd354861caee637c3f5d48dcbd0200739a362159ecad59aa83ba90ec1b607d39ce919ea0b1cee746535b7da05fb9785acfd1
7
- data.tar.gz: fc2fe38dab3c905483c1f946c6239d479bb827de954cc6504a2046d02762cdbdd3435e411837e7bfa3d319bcff99cdba502eba66c32c688c61b05733e2758c1e
6
+ metadata.gz: 65eccdf9af7bae3928fa0310e17e823c2c308bb21884cb70d264175fbf1d73716e5a8e2d8ff3bed7a316033fb7d61763cc70ae6411fb68566cbf599fb0fd535d
7
+ data.tar.gz: 138adab4d8821378740b0214553c2a8ef6ac0cb7ce96cdf0029b437fb30bc3776958f81aa00dddbc855d137114388ae7b4ef4513df41d0ab280f34563342b95d
@@ -1,2 +1,18 @@
1
+ ## unreleased
2
+ - Add `uncolor` method to remove ANSI color sequences.
3
+
4
+
5
+ ## v1.1.0
6
+ - Print out method keyword arguments
7
+ - Fix NoMethodError with Sequel
8
+ - Code cleanups
9
+
10
+ Thanks for the great contributions from:
11
+
12
+ - andydna
13
+ - beanieboi
14
+
15
+
16
+
1
17
  ## v1.0.0
2
18
  - Initial Release.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in amazing_print.gemspec
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  MIT License
2
2
 
3
+ Copyright (c) 2010-2019 Michael Dvorkin
3
4
  Copyright (c) 2020 AmazingPrint
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler/setup'
3
5
 
@@ -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.
@@ -8,7 +10,7 @@
8
10
  # so do nothing for subsequent requires.
9
11
  #
10
12
  unless defined?(AmazingPrint::Inspector)
11
- %w[awesome_method_array string method object class kernel].each do |file|
13
+ %w[awesome_method_array string object class kernel].each do |file|
12
14
  require_relative "amazing_print/core_ext/#{file}"
13
15
  end
14
16
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  autoload :CGI, 'cgi'
2
4
 
3
5
  module AmazingPrint
@@ -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.
@@ -76,7 +78,7 @@ module AwesomeMethodArray #:nodoc:
76
78
  super(pattern)
77
79
  end
78
80
  arr.instance_variable_set(:@__awesome_methods__, instance_variable_get(:@__awesome_methods__))
79
- arr.reject! { |item| !(item.is_a?(Symbol) || item.is_a?(String)) } # grep block might return crap.
81
+ arr.select! { |item| (item.is_a?(Symbol) || item.is_a?(String)) } # grep block might return crap.
80
82
  arr
81
83
  end
82
84
  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.
@@ -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,4 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
3
  #
3
4
  # AmazingPrint is freely distributable under the terms of MIT license.
@@ -37,6 +38,8 @@ class String
37
38
  end
38
39
  end
39
40
 
40
- alias black grayish
41
- alias pale whiteish
41
+ # Remove ANSI color codes.
42
+ def uncolor
43
+ gsub(/\e\[[0-9;]*m/, '')
44
+ end
42
45
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AmazingPrint
2
4
  class << self
3
5
  attr_accessor :defaults, :force_colors
@@ -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.
@@ -53,7 +55,7 @@ module AmazingPrint
53
55
  end
54
56
  end
55
57
  end
56
- "#{object} " << awesome_hash(data)
58
+ "#{object} " + awesome_hash(data)
57
59
  end
58
60
 
59
61
  # Format ActiveRecord class 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,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
@@ -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.
@@ -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) && object&.name != "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,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.
@@ -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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AmazingPrint
2
4
  module Formatters
3
5
  require_relative 'formatters/object_formatter'
@@ -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
@@ -93,7 +95,7 @@ module AmazingPrint
93
95
  # #<UnboundMethod: Hello#world>
94
96
  # #<UnboundMethod: Hello#world() /home/hs/code/amazing_print/spec/methods_spec.rb:68>
95
97
  #
96
- if method.to_s =~ /(Unbound)*Method: ((#<)?[^\/#]*)[#\.]/
98
+ if method.to_s =~ %r{(Unbound)*Method: ((#<)?[^/#]*)[#\.]}
97
99
  unbound = Regexp.last_match(1) && '(unbound)'
98
100
  klass = Regexp.last_match(2)
99
101
  if klass && klass =~ /(\(\w+:\s.*?\))/ # Is this ActiveRecord-style class?
@@ -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 'shellwords'
2
4
 
3
5
  require_relative 'base_formatter'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'shellwords'
2
4
 
3
5
  require_relative 'base_formatter'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_formatter'
2
4
 
3
5
  module AmazingPrint
@@ -88,7 +90,7 @@ module AmazingPrint
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
@@ -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
@@ -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
@@ -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.
@@ -5,6 +7,6 @@
5
7
  #------------------------------------------------------------------------------
6
8
  module AmazingPrint
7
9
  def self.version
8
- '1.1.0'
10
+ '1.2.0'
9
11
  end
10
12
  end
data/lib/ap.rb CHANGED
@@ -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
  if ExtVerifier.has_rails?
2
4
  # Required to use the column support
3
5
  module Rails
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint' do
@@ -18,8 +20,8 @@ RSpec.describe 'AmazingPrint' do
18
20
  end
19
21
 
20
22
  describe 'colorization' do
21
- PLAIN = '[ 1, :two, "three", [ nil, [ true, false ] ] ]'.freeze
22
- COLORIZED = "[ \e[1;34m1\e[0m, \e[0;36m:two\e[0m, \e[0;33m\"three\"\e[0m, [ \e[1;31mnil\e[0m, [ \e[1;32mtrue\e[0m, \e[1;31mfalse\e[0m ] ] ]".freeze
23
+ PLAIN = '[ 1, :two, "three", [ nil, [ true, false ] ] ]'
24
+ COLORIZED = "[ \e[1;34m1\e[0m, \e[0;36m:two\e[0m, \e[0;33m\"three\"\e[0m, [ \e[1;31mnil\e[0m, [ \e[1;32mtrue\e[0m, \e[1;31mfalse\e[0m ] ] ]"
23
25
 
24
26
  before do
25
27
  ENV['TERM'] = 'xterm-colors'
@@ -110,5 +112,12 @@ RSpec.describe 'AmazingPrint' do
110
112
  end
111
113
  end
112
114
  end
115
+
116
+ describe 'uncolor' do
117
+ it 'removes any ANSI color codes' do
118
+ expect('red'.red + 'blue'.blue).to eq "\e[1;31mred\e[0m\e[1;34mblue\e[0m"
119
+ expect(('red'.red + 'blue'.blue).uncolor).to eq 'redblue'
120
+ end
121
+ end
113
122
  end
114
123
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  require 'logger'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'String extensions' do
@@ -10,11 +12,4 @@ RSpec.describe 'String extensions' do
10
12
  expect(color.to_s.send(:"#{color}ish")).to eq("\e[0;#{30 + i}m#{color}\e[0m")
11
13
  end
12
14
  end
13
-
14
- it 'should have black and pale colors' do
15
- expect('black'.send(:black)).to eq('black'.send(:grayish))
16
- expect('pale'.send(:pale)).to eq('pale'.send(:whiteish))
17
- expect('pale'.send(:pale)).to eq("\e[0;37mpale\e[0m")
18
- expect('whiteish'.send(:whiteish)).to eq("\e[0;37mwhiteish\e[0m")
19
- end
20
15
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe 'AmazingPrint::ActionController', skip: -> { !ExtVerifier.has_rails? }.call do
6
+ let(:inspector) { AmazingPrint::Inspector.new }
7
+
8
+ context 'with unpermitted ActionController::Parameters' do
9
+ let(:parameters) do
10
+ ActionController::Parameters.new post: { id: 1, content: 'Some' }
11
+ end
12
+
13
+ it 'should format as an object' do
14
+ expect(inspector.send(:awesome, parameters)).to eq(
15
+ '<ActionController::Parameters {"post"=>{"id"=>1, "content"=>"Some"}} permitted: false>'
16
+ )
17
+ end
18
+ end
19
+
20
+ context 'with permitted ActionController::Parameters' do
21
+ let(:expected_output) do
22
+ <<~OUTPUT
23
+ {
24
+ \"post\"\e[0;37m => \e[0m{
25
+ \"id\"\e[0;37m => \e[0m\e[1;34m1\e[0m,
26
+ \"content\"\e[0;37m => \e[0m\e[0;33m\"Some\"\e[0m
27
+ }
28
+ }
29
+ OUTPUT
30
+ .chomp
31
+ end
32
+ let(:parameters) do
33
+ ActionController::Parameters.new post: { id: 1, content: 'Some' }
34
+ end
35
+
36
+ it 'should format as a hash' do
37
+ expect(inspector.send(:awesome, parameters.permit!)).to eq expected_output
38
+ end
39
+ end
40
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint ActionView extensions', skip: -> { !ExtVerifier.has_rails? }.call do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'active_record_helper'
3
5
 
@@ -257,9 +259,9 @@ RSpec.describe 'AmazingPrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }
257
259
  )
258
260
  elsif RUBY_VERSION >= '2.7.0'
259
261
  expect(out).to match(
260
- /\s*first\(\*args,\s+&block\)\s+#<Class:ActiveRecord::Base> \(ActiveRecord::Querying\)/
262
+ /\s*first\(\*(\*|args),\s+&(&|block)\)\s+#<Class:ActiveRecord::Base> \(ActiveRecord::Querying\)/
261
263
  )
262
- elsif RUBY_VERSION >= '2.4.4'
264
+ elsif RUBY_VERSION =~ /^2\.4\.([4-9]|[1-9][0-9])|^2\.[56]\./
263
265
  expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/)
264
266
  elsif RUBY_VERSION >= '1.9'
265
267
  expect(out).to match(/\sfirst\(\*args,\s&block\)\s+Class \(ActiveRecord::Querying\)/)
@@ -280,7 +282,7 @@ RSpec.describe 'AmazingPrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }
280
282
  expect(out).to match(
281
283
  /\sprimary_key\(.*?\)\s+.+Class.+\(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/
282
284
  )
283
- elsif RUBY_VERSION >= '2.4.4'
285
+ elsif RUBY_VERSION =~ /^2\.4\.([4-9]|[1-9][0-9])|^2\.[56]\./
284
286
  expect(out).to match(/\sprimary_key\(.*?\)\s+User/)
285
287
  else
286
288
  expect(out).to match(/\sprimary_key\(.*?\)\s+Class \(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/)
@@ -294,11 +296,11 @@ RSpec.describe 'AmazingPrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }
294
296
  else
295
297
  if RUBY_PLATFORM == 'java'
296
298
  expect(out).to match(/\svalidate\(\*arg.*?\)\s+#<Class:\w+> \(ActiveModel::Validations::ClassMethods\)/)
297
- elsif RUBY_VERSION >= '2.7.0'
299
+ elsif RUBY_VERSION >= '2.7.0'
298
300
  expect(out).to match(
299
301
  /\svalidate\(\*args.*?\)\s+#<Class:ActiveRecord::Base> \(ActiveModel::Validations::ClassMethods\)/
300
302
  )
301
- elsif RUBY_VERSION >= '2.4.4'
303
+ elsif RUBY_VERSION =~ /^2\.4\.([4-9]|[1-9][0-9])|^2\.[56]\./
302
304
  expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/)
303
305
  else
304
306
  expect(out).to match(/\svalidate\(\*arg.*?\)\s+Class \(ActiveModel::Validations::ClassMethods\)/)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint::ActiveSupport', skip: -> { !ExtVerifier.has_rails? }.call do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint/MongoMapper', skip: -> { !ExtVerifier.has_mongo_mapper? }.call do
@@ -232,10 +234,10 @@ RSpec.describe 'AmazingPrint/MongoMapper', skip: -> { !ExtVerifier.has_mongo_map
232
234
  describe 'with show associations turned on and inline embedded turned on' do
233
235
  before :each do
234
236
  @ap = AmazingPrint::Inspector.new plain: true,
235
- mongo_mapper: {
236
- show_associations: true,
237
- inline_embedded: true
238
- }
237
+ mongo_mapper: {
238
+ show_associations: true,
239
+ inline_embedded: true
240
+ }
239
241
  end
240
242
 
241
243
  it 'should render an instance with associations shown and embeds there' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint/Mongoid', skip: -> { !ExtVerifier.has_mongoid? }.call do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint/NoBrainer', skip: -> { !ExtVerifier.has_nobrainer? }.call do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint/Nokogiri' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint Ostruct extension' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint/Ripple', skip: -> { !ExtVerifier.has_ripple? }.call do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'sequel_helper'
3
5
 
@@ -8,36 +10,36 @@ RSpec.describe 'AmazingPrint/Sequel', skip: -> { !ExtVerifier.has_sequel? }.call
8
10
  @user2 = SequelUser.new first_name: 'Sequel', last_name: 'Five'
9
11
  end
10
12
 
11
- it 'display single record' do
12
- out = @ap.awesome(@user1)
13
- str = <<~EOS.strip
14
- #<SequelUser:placeholder_id> {
15
- :first_name => "Jeremy",
16
- :last_name => "Evans"
17
- }
18
- EOS
19
- expect(out).to be_similar_to(str)
20
- end
13
+ it 'display single record' do
14
+ out = @ap.awesome(@user1)
15
+ str = <<~EOS.strip
16
+ #<SequelUser:placeholder_id> {
17
+ :first_name => "Jeremy",
18
+ :last_name => "Evans"
19
+ }
20
+ EOS
21
+ expect(out).to be_similar_to(str)
22
+ end
21
23
 
22
- it 'display multiple records' do
23
- out = @ap.awesome([@user1, @user2])
24
- str = <<~EOS.strip
25
- [
26
- [0] #<SequelUser:placeholder_id> {
27
- :first_name => "Jeremy",
28
- :last_name => "Evans"
29
- },
30
- [1] #<SequelUser:placeholder_id> {
31
- :first_name => "Sequel",
32
- :last_name => "Five"
33
- }
34
- ]
35
- EOS
36
- expect(out).to be_similar_to(str)
37
- end
24
+ it 'display multiple records' do
25
+ out = @ap.awesome([@user1, @user2])
26
+ str = <<~EOS.strip
27
+ [
28
+ [0] #<SequelUser:placeholder_id> {
29
+ :first_name => "Jeremy",
30
+ :last_name => "Evans"
31
+ },
32
+ [1] #<SequelUser:placeholder_id> {
33
+ :first_name => "Sequel",
34
+ :last_name => "Five"
35
+ }
36
+ ]
37
+ EOS
38
+ expect(out).to be_similar_to(str)
39
+ end
38
40
 
39
41
  it 'does not crash if on Sequel::Model' do
40
42
  out = @ap.awesome(::Sequel::Model)
41
- expect(out).to be_similar_to("Sequel::Model < Object")
43
+ expect(out).to be_similar_to('Sequel::Model < Object')
42
44
  end
43
45
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'bigdecimal'
3
5
  require 'set'
@@ -489,7 +491,7 @@ RSpec.describe 'AmazingPrint' do
489
491
  describe 'File' do
490
492
  it 'should display a file (plain)' do
491
493
  File.open(__FILE__, 'r') do |f|
492
- expect(f.ai(plain: true)).to eq("#{f.inspect}\n" << `ls -alF #{f.path}`.chop)
494
+ expect(f.ai(plain: true)).to eq("#{f.inspect}\n" + `ls -alF #{f.path}`.chop)
493
495
  end
494
496
  end
495
497
  end
@@ -498,7 +500,7 @@ RSpec.describe 'AmazingPrint' do
498
500
  describe 'Dir' do
499
501
  it 'should display a direcory (plain)' do
500
502
  Dir.open(File.dirname(__FILE__)) do |d|
501
- expect(d.ai(plain: true)).to eq("#{d.inspect}\n" << `ls -alF #{d.path}`.chop)
503
+ expect(d.ai(plain: true)).to eq("#{d.inspect}\n" + `ls -alF #{d.path}`.chop)
502
504
  end
503
505
  end
504
506
  end
@@ -566,19 +568,19 @@ RSpec.describe 'AmazingPrint' do
566
568
  end
567
569
  else # Prior to Ruby 1.9 the order of set values is unpredicatble.
568
570
  it 'plain multiline' do
569
- expect(@set.sort_by { |x| x.to_s }.ai(plain: true)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true))
571
+ expect(@set.sort_by(&:to_s).ai(plain: true)).to eq(@arr.sort_by(&:to_s).ai(plain: true))
570
572
  end
571
573
 
572
574
  it 'plain multiline indented' do
573
- expect(@set.sort_by { |x| x.to_s }.ai(plain: true, indent: 1)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true, indent: 1))
575
+ expect(@set.sort_by(&:to_s).ai(plain: true, indent: 1)).to eq(@arr.sort_by(&:to_s).ai(plain: true, indent: 1))
574
576
  end
575
577
 
576
578
  it 'plain single line' do
577
- expect(@set.sort_by { |x| x.to_s }.ai(plain: true, multiline: false)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true, multiline: false))
579
+ expect(@set.sort_by(&:to_s).ai(plain: true, multiline: false)).to eq(@arr.sort_by(&:to_s).ai(plain: true, multiline: false))
578
580
  end
579
581
 
580
582
  it 'colored multiline (default)' do
581
- expect(@set.sort_by { |x| x.to_s }.ai).to eq(@arr.sort_by { |x| x.to_s }.ai)
583
+ expect(@set.sort_by(&:to_s).ai).to eq(@arr.sort_by(&:to_s).ai)
582
584
  end
583
585
  end
584
586
  end
@@ -695,7 +697,7 @@ RSpec.describe 'AmazingPrint' do
695
697
  rescue StandardError
696
698
  File.new('nul')
697
699
  end
698
- expect(my.ai(plain: true)).to eq("#{my.inspect}\n" << `ls -alF #{my.path}`.chop)
700
+ expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop)
699
701
  end
700
702
 
701
703
  it 'inherited from Dir should be displayed as Dir' do
@@ -703,7 +705,7 @@ RSpec.describe 'AmazingPrint' do
703
705
 
704
706
  require 'tmpdir'
705
707
  my = My.new(Dir.tmpdir)
706
- expect(my.ai(plain: true)).to eq("#{my.inspect}\n" << `ls -alF #{my.path}`.chop)
708
+ expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop)
707
709
  end
708
710
 
709
711
  it 'should handle a class that defines its own #send method' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'Single method' do
@@ -486,16 +488,16 @@ RSpec.describe 'Methods arrays' do
486
488
  def him; end
487
489
 
488
490
  def his
489
- private_methods.grep(/^h..$/) { |n| n.to_sym }
491
+ private_methods.grep(/^h..$/, &:to_sym)
490
492
  end
491
493
 
492
494
  def her
493
- private_methods.grep(/^.e.$/) { |n| n.to_sym }
495
+ private_methods.grep(/^.e.$/, &:to_sym)
494
496
  end
495
497
  end
496
498
 
497
499
  hello = Hello.new
498
- expect((hello.send(:his) - hello.send(:her)).sort_by { |x| x.to_s }).to eq(%i[him his])
500
+ expect((hello.send(:his) - hello.send(:her)).sort_by(&:to_s)).to eq(%i[him his])
499
501
  end
500
502
 
501
503
  it 'appending garbage to methods array should not raise error' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'AmazingPrint' do
@@ -14,7 +16,7 @@ RSpec.describe 'AmazingPrint' do
14
16
  it 'handle frozen object.inspect' do
15
17
  weird = Class.new do
16
18
  def inspect
17
- 'ice'.freeze
19
+ 'ice'
18
20
  end
19
21
  end
20
22
  expect(weird.new.ai(plain: false)).to eq('ice')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'Objects' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ExtVerifier.has_sequel?
2
4
  # Establish connection to in-memory SQLite DB
3
5
  DB = RUBY_PLATFORM == 'java' ? Sequel.connect('jdbc:sqlite::memory:') : Sequel.sqlite
@@ -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.
@@ -21,7 +23,7 @@
21
23
  $LOAD_PATH.unshift(File.dirname(__FILE__))
22
24
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
23
25
 
24
- Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each do |file|
26
+ Dir[File.dirname(__FILE__) + '/support/**/*.rb'].sort.each do |file|
25
27
  require file
26
28
  end
27
29
 
@@ -29,6 +31,7 @@ ExtVerifier.require_dependencies!(
29
31
  %w[
30
32
  rails
31
33
  active_record
34
+ action_controller
32
35
  action_view
33
36
  active_support/all
34
37
  mongoid
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  class ActiveRecordData
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExtVerifier
2
4
  def require_dependencies!(dependencies)
3
5
  dependencies.each do |dependency|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MongoidVersions
2
4
  def mongoid_version
3
5
  Gem::Version.new(Mongoid::VERSION)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RailsVersions
2
4
  def rails_version
3
5
  Gem::Version.new(Rails::VERSION::STRING)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazing_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dvorkin
8
8
  - Kevin McCormackPatrik Wenger
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-29 00:00:00.000000000 Z
12
+ date: 2020-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: appraisal
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: 3.0.0
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 0.81.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.81.0
84
98
  description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
85
99
  their structure. Supports custom object formatting via plugins'
86
100
  email: harlemsquirrel@gmail.com
@@ -103,7 +117,6 @@ files:
103
117
  - lib/amazing_print/core_ext/class.rb
104
118
  - lib/amazing_print/core_ext/kernel.rb
105
119
  - lib/amazing_print/core_ext/logger.rb
106
- - lib/amazing_print/core_ext/method.rb
107
120
  - lib/amazing_print/core_ext/object.rb
108
121
  - lib/amazing_print/core_ext/string.rb
109
122
  - lib/amazing_print/custom_defaults.rb
@@ -137,6 +150,7 @@ files:
137
150
  - spec/colors_spec.rb
138
151
  - spec/core_ext/logger_spec.rb
139
152
  - spec/core_ext/string_spec.rb
153
+ - spec/ext/action_controller_spec.rb
140
154
  - spec/ext/action_view_spec.rb
141
155
  - spec/ext/active_record_spec.rb
142
156
  - spec/ext/active_support_spec.rb
@@ -181,7 +195,7 @@ homepage: https://github.com/amazing-print/amazing_print
181
195
  licenses:
182
196
  - MIT
183
197
  metadata: {}
184
- post_install_message:
198
+ post_install_message:
185
199
  rdoc_options: []
186
200
  require_paths:
187
201
  - lib
@@ -189,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
203
  requirements:
190
204
  - - ">="
191
205
  - !ruby/object:Gem::Version
192
- version: '0'
206
+ version: 2.3.0
193
207
  required_rubygems_version: !ruby/object:Gem::Requirement
194
208
  requirements:
195
209
  - - ">="
@@ -197,51 +211,52 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
211
  version: '0'
198
212
  requirements: []
199
213
  rubygems_version: 3.1.2
200
- signing_key:
214
+ signing_key:
201
215
  specification_version: 4
202
216
  summary: Pretty print Ruby objects with proper indentation and colors
203
217
  test_files:
204
- - spec/methods_spec.rb
205
- - spec/spec_helper.rb
206
- - spec/colors_spec.rb
207
- - spec/formats_spec.rb
208
- - spec/active_record_helper.rb
209
- - spec/objects_spec.rb
210
- - spec/ext/active_record_spec.rb
211
- - spec/ext/action_view_spec.rb
212
- - spec/ext/ostruct_spec.rb
213
- - spec/ext/mongoid_spec.rb
214
- - spec/ext/ripple_spec.rb
215
- - spec/ext/sequel_spec.rb
216
- - spec/ext/active_support_spec.rb
217
- - spec/ext/nokogiri_spec.rb
218
- - spec/ext/mongo_mapper_spec.rb
219
- - spec/ext/nobrainer_spec.rb
220
- - spec/core_ext/string_spec.rb
221
- - spec/core_ext/logger_spec.rb
218
+ - spec/support/rails_versions.rb
222
219
  - spec/support/mongoid_versions.rb
223
- - spec/support/active_record_data/6_0_diana.txt
224
- - spec/support/active_record_data/4_2_diana.txt
225
- - spec/support/active_record_data/4_2_multi_legacy.txt
226
- - spec/support/active_record_data/3_2_diana.txt
227
- - spec/support/active_record_data/4_0_diana.txt
220
+ - spec/support/ext_verifier.rb
228
221
  - spec/support/active_record_data/4_2_diana_legacy.txt
222
+ - spec/support/active_record_data/4_2_multi_legacy.txt
229
223
  - spec/support/active_record_data/5_1_diana.txt
224
+ - spec/support/active_record_data/4_2_diana.txt
225
+ - spec/support/active_record_data/5_2_diana.txt
226
+ - spec/support/active_record_data/4_1_diana.txt
227
+ - spec/support/active_record_data/6_0_diana.txt
228
+ - spec/support/active_record_data/5_0_diana.txt
229
+ - spec/support/active_record_data/5_2_multi.txt
230
+ - spec/support/active_record_data/4_1_multi.txt
231
+ - spec/support/active_record_data/3_2_diana_legacy.txt
230
232
  - spec/support/active_record_data/6_0_multi.txt
231
- - spec/support/active_record_data/3_2_multi_legacy.txt
232
233
  - spec/support/active_record_data/5_0_multi.txt
233
- - spec/support/active_record_data/5_2_multi.txt
234
+ - spec/support/active_record_data/3_2_diana.txt
235
+ - spec/support/active_record_data/3_2_multi_legacy.txt
234
236
  - spec/support/active_record_data/4_2_multi.txt
235
237
  - spec/support/active_record_data/5_1_multi.txt
236
- - spec/support/active_record_data/4_0_multi.txt
237
- - spec/support/active_record_data/3_2_diana_legacy.txt
238
- - spec/support/active_record_data/4_1_multi.txt
239
- - spec/support/active_record_data/5_2_diana.txt
240
- - spec/support/active_record_data/4_1_diana.txt
241
238
  - spec/support/active_record_data/3_2_multi.txt
242
- - spec/support/active_record_data/5_0_diana.txt
243
- - spec/support/rails_versions.rb
239
+ - spec/support/active_record_data/4_0_diana.txt
240
+ - spec/support/active_record_data/4_0_multi.txt
244
241
  - spec/support/active_record_data.rb
245
- - spec/support/ext_verifier.rb
246
- - spec/sequel_helper.rb
242
+ - spec/formats_spec.rb
243
+ - spec/objects_spec.rb
247
244
  - spec/misc_spec.rb
245
+ - spec/colors_spec.rb
246
+ - spec/active_record_helper.rb
247
+ - spec/core_ext/logger_spec.rb
248
+ - spec/core_ext/string_spec.rb
249
+ - spec/sequel_helper.rb
250
+ - spec/methods_spec.rb
251
+ - spec/ext/nobrainer_spec.rb
252
+ - spec/ext/ostruct_spec.rb
253
+ - spec/ext/nokogiri_spec.rb
254
+ - spec/ext/active_support_spec.rb
255
+ - spec/ext/active_record_spec.rb
256
+ - spec/ext/action_view_spec.rb
257
+ - spec/ext/sequel_spec.rb
258
+ - spec/ext/ripple_spec.rb
259
+ - spec/ext/mongo_mapper_spec.rb
260
+ - spec/ext/mongoid_spec.rb
261
+ - spec/ext/action_controller_spec.rb
262
+ - spec/spec_helper.rb
@@ -1,21 +0,0 @@
1
- # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
- #
3
- # AmazingPrint is freely distributable under the terms of MIT license.
4
- # See LICENSE file or http://www.opensource.org/licenses/mit-license.php
5
- #------------------------------------------------------------------------------
6
- #
7
- # Method#name was intorduced in Ruby 1.8.7 so we define it here as necessary.
8
- #
9
- unless nil.method(:class).respond_to?(:name)
10
- class Method
11
- def name
12
- inspect.split(/[#.>]/)[-1]
13
- end
14
- end
15
-
16
- class UnboundMethod
17
- def name
18
- inspect.split(/[#.>]/)[-1]
19
- end
20
- end
21
- end