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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 806491a973073e36b330fad7b64e69dbc283647d2509609c5aa79d24269ee17b
4
- data.tar.gz: 96ec9502e108582a6f54f01950d52b5de151928af721bcb8c4696f4a10baa14a
3
+ metadata.gz: 63ce7e50d17b53a5270709def03c7f3075a7068ada7d11ca7f124bda5cddc735
4
+ data.tar.gz: de6d68e51a4e70fdad3fff7fc5050ab6984280afaa3851a9958bf24731bb022d
5
5
  SHA512:
6
- metadata.gz: 33030793c2ebf21436b3633a5316e961ad73e5caed621509a36447146ba452634ff5a5ab791002382e07fccf43e3f06b4fbea594e17cf057ae7839629ca2864e
7
- data.tar.gz: d401f7bb5f85f052a6155864dfbbdb73c257f2b0e982226ecf203b6a024f05b8f3e30413d82ae2c02a983363fdd46a44c4ed7f6cfbe57395727d1eb69f0785c8
6
+ metadata.gz: cb0a4eb248f06fd34e28d5161ab984653af5661347e4d32e76ec3b2be995ff31f9fec4b5c8355a19908bd16f7219ed2148556d383bbb36af740925e5a4ec9004
7
+ data.tar.gz: c48fe1109d33a49653f8f506233c5bf674137008fed98d083022b46a72b26aa0cd469f13bca4ef1b6b2bdee1657bcf8d66481e505cca045de47dd00a40a6475f
data/.gitignore CHANGED
@@ -32,4 +32,4 @@ Gemfile.lock
32
32
 
33
33
  # PROJECT::RBENV
34
34
  .ruby-gemset
35
- .awesome-print/
35
+ *.gem
data/Appraisals CHANGED
@@ -1,60 +1,56 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # appraise 'rails-4.2' do
4
- # gem 'rails', '~> 4.2.0'
5
- #
6
- # # The last version that doesn't need Ruby 2.0 and works with version 4.2 of
7
- # # Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
8
- # gem 'mime-types', '2.6.2', :platforms => :ruby_19
9
- # end
10
-
11
- appraise 'rails-5.1' do
12
- gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0', platform: :jruby
13
- gem 'rails', '~> 5.1.0'
14
- gem 'sqlite3', platform: :mri
3
+ if RUBY_VERSION < '3'
4
+ appraise 'rails-5.1' do
5
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0', platform: :jruby
6
+ gem 'rails', '~> 5.1.0'
7
+ gem 'sqlite3', platform: :mri
8
+ end
9
+
10
+ appraise 'rails-5.2' do
11
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0', platform: :jruby
12
+ gem 'rails', '~> 5.2.0'
13
+ gem 'sqlite3', platform: :mri
14
+ end
15
+
16
+ appraise 'rails-6.0' do
17
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0', platform: :jruby
18
+ gem 'rails', '~> 6.0.0'
19
+ gem 'sqlite3', platform: :mri
20
+ end
21
+
22
+ appraise 'mongoid-4.0' do
23
+ # https://github.com/rails/rails/issues/34822#issuecomment-570670516
24
+ gem 'bigdecimal', '~> 1.4', platforms: :mri
25
+ gem 'mongoid', '~> 4.0.0'
26
+ end
27
+
28
+ appraise 'mongoid-5.0' do
29
+ # https://github.com/rails/rails/issues/34822#issuecomment-570670516
30
+ gem 'bigdecimal', '~> 1.4', platforms: :mri
31
+ gem 'mongoid', '~> 5.0.0'
32
+ end
33
+
34
+ appraise 'mongoid-6.0' do
35
+ gem 'mongoid', '~> 6.0.0'
36
+ end
37
+
38
+ appraise 'mongo_mapper' do
39
+ gem 'activemodel', '~> 4.2.0'
40
+ gem 'activesupport', '~> 4.2.0'
41
+ gem 'bigdecimal', '~> 1.4', platforms: :mri
42
+ gem 'mongo_mapper', '~> 0.14'
43
+ end
15
44
  end
16
45
 
17
- appraise 'rails-5.2' do
18
- gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0', platform: :jruby
19
- gem 'rails', '~> 5.2.0'
46
+ appraise 'rails-6.1' do
47
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0', platform: :jruby
48
+ gem 'rails', '~> 6.1.0'
20
49
  gem 'sqlite3', platform: :mri
21
50
  end
22
51
 
23
- appraise 'rails-6.0' do
24
- gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0', platform: :jruby
25
- gem 'rails', '~> 6.0.0'
52
+ appraise 'sequel-5.0' do
53
+ gem 'jdbc-sqlite3', platform: :jruby
54
+ gem 'sequel', '~> 5.0'
26
55
  gem 'sqlite3', platform: :mri
27
56
  end
28
-
29
- appraise 'mongoid-4.0' do
30
- # https://github.com/rails/rails/issues/34822#issuecomment-570670516
31
- gem 'bigdecimal', '~> 1.4', platforms: :mri
32
- gem 'mongoid', '~> 4.0.0'
33
- end
34
-
35
- appraise 'mongoid-5.0' do
36
- # https://github.com/rails/rails/issues/34822#issuecomment-570670516
37
- gem 'bigdecimal', '~> 1.4', platforms: :mri
38
- gem 'mongoid', '~> 5.0.0'
39
- end
40
-
41
- appraise 'mongoid-6.0' do
42
- gem 'mongoid', '~> 6.0.0'
43
- end
44
-
45
- # appraise 'mongo_mapper' do
46
- # gem 'mongo_mapper'
47
- # end
48
- #
49
- # appraise 'ripple' do
50
- # gem 'tzinfo'
51
- # gem 'ripple'
52
- # end
53
- #
54
- # appraise 'nobrainer' do
55
- # gem 'nobrainer'
56
- #
57
- # # When activesupport 5 was released, it required ruby 2.2.2 as a minimum.
58
- # # Locking this down to 4.2.6 allows our Ruby 1.9 tests to keep working.
59
- # gem 'activesupport', '4.2.6', :platforms => :ruby_19
60
- # end
data/CHANGELOG.md CHANGED
@@ -1,2 +1,34 @@
1
+ ## v1.2.2
2
+ - Support Ruby 3.0 / IRB 1.2.6 - #57
3
+ - Fix FrozenError - #51
4
+ - Drop support for Ruby 2.3 and 2.4 as well as JRuby 9.1 - #46
5
+ - Add passing of `options` to `Logger#ap` - #55
6
+
7
+ ## v1.2.1
8
+ - Correctly print active_model_errors for models that don't have tables - #42 by sahglie
9
+ - Update AmazingPrint::MongoMapper for frozen strings - #44
10
+
11
+ ## v1.2.0
12
+
13
+ - Fix frozen string literal issue with ActiveRecord
14
+ - Add uncolor String method to remove ANSI color codes - #30 by duffyjp
15
+ - Restore original copyright - #33 by amarshall
16
+ - Remove method core extension since it is not needed since ruby 1.9 - #37 by grosser
17
+ - Remove pale and black string color aliases - #38
18
+ - Fix formatting ActionController::Parameters - #29
19
+
20
+
21
+ ## v1.1.0
22
+ - Print out method keyword arguments
23
+ - Fix NoMethodError with Sequel
24
+ - Code cleanups
25
+
26
+ Thanks for the great contributions from:
27
+
28
+ - andydna
29
+ - beanieboi
30
+
31
+
32
+
1
33
  ## v1.0.0
2
34
  - 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/README.md CHANGED
@@ -1,13 +1,17 @@
1
1
  ## Amazing Print ##
2
2
 
3
3
  [![RubyGems][gem_version_badge]][ruby_gems]
4
- [![Travis CI][travis_ci_badge]][travis_ci]
5
- [![Code Climate][code_climate_badge]][code_climate]
6
- [![Code Climate Coverage][code_climate_coverage_badge]][code_climate]
7
4
  [![RubyGems][gem_downloads_badge]][ruby_gems]
5
+ |
6
+ [![Travis CI][travis_ci_badge]][travis_ci]
7
+ ![Specs](https://github.com/amazing-print/amazing_print/workflows/Specs/badge.svg)
8
+ ![Lint](https://github.com/amazing-print/amazing_print/workflows/Lint/badge.svg)
9
+ |
8
10
  [![Gitter](https://badges.gitter.im/amazing-print/community.svg)](https://gitter.im/amazing-print/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
9
11
 
10
- Amazing Print is a fork of [AmazingPrint](https://github.com/awesome-print/awesome_print) which became stale and should be used in it's place to avoid conflicts. It is a Ruby library that pretty prints Ruby objects in full color exposing their internal structure with proper indentation. Rails ActiveRecord objects and usage within Rails templates are supported via included mixins.
12
+ AmazingPrint is a fork of [AwesomePrint](https://github.com/awesome-print/awesome_print) which became stale and should be used in its place to avoid conflicts. It is a Ruby library that pretty prints Ruby objects in full color exposing their internal structure with proper indentation. Rails ActiveRecord objects and usage within Rails templates are supported via included mixins.
13
+
14
+ ![GitHub API demo](github-api-demo.gif)
11
15
 
12
16
  ### Supported Versions ###
13
17
 
@@ -44,7 +48,7 @@ ruby19_syntax: false, # Use Ruby 1.9 hash syntax in output.
44
48
  class_name: :class, # Method called to report the instance class name. (e.g. :to_s)
45
49
  object_id: true, # Show object id.
46
50
  color: {
47
- args: :pale,
51
+ args: :whiteish,
48
52
  array: :white,
49
53
  bigdecimal: :blue,
50
54
  class: :yellow,
@@ -52,13 +56,13 @@ color: {
52
56
  falseclass: :red,
53
57
  integer: :blue,
54
58
  float: :blue,
55
- hash: :pale,
59
+ hash: :whiteish,
56
60
  keyword: :cyan,
57
61
  method: :purpleish,
58
62
  nilclass: :red,
59
63
  rational: :blue,
60
64
  string: :yellowish,
61
- struct: :pale,
65
+ struct: :whiteish,
62
66
  symbol: :cyanish,
63
67
  time: :greenish,
64
68
  trueclass: :green,
@@ -70,7 +74,7 @@ Supported color names:
70
74
 
71
75
  ```ruby
72
76
  :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white
73
- :black, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :pale
77
+ :grayish, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :whiteish
74
78
  ```
75
79
 
76
80
  Use `Object#ai` to return an ASCII encoded string:
@@ -293,6 +297,12 @@ By default, this logs at the :debug level. You can override that globally with:
293
297
  in the custom defaults (see below). You can also override on a per call basis with:
294
298
 
295
299
  logger.ap object, :warn
300
+ # or
301
+ logger.ap object, level: :warn
302
+
303
+ You can also pass additional options (providing `nil` or leaving off `level` will log at the default level):
304
+
305
+ logger.ap object, { level: :info, sort_keys: true }
296
306
 
297
307
  ### ActionView Convenience Method ###
298
308
  amazing_print adds the 'ap' method to the ActionView::Base class making it available
@@ -305,7 +315,7 @@ With other web frameworks (ex: in Sinatra templates) you can explicitly request
305
315
  formatting:
306
316
 
307
317
  <%= ap @accounts.first, :html => true %>
308
-
318
+
309
319
  ### String Convenience Methods ###
310
320
  Use methods such as `.red` to set string color:
311
321
 
@@ -324,7 +334,7 @@ For example:
324
334
  AmazingPrint.defaults = {
325
335
  :indent => -2,
326
336
  :color => {
327
- :hash => :pale,
337
+ :hash => :whiteish,
328
338
  :class => :white
329
339
  }
330
340
  }
@@ -351,6 +361,3 @@ Released under the MIT license. See LICENSE file for details.
351
361
  [ruby_gems]: http://rubygems.org/gems/amazing_print
352
362
  [travis_ci]: http://travis-ci.org/amazing-print/amazing_print
353
363
  [travis_ci_badge]: https://img.shields.io/travis/amazing-print/amazing_print/master.svg?style=flat
354
- [code_climate]: https://codeclimate.com/github/amazing-print/amazing_print
355
- [code_climate_badge]: http://img.shields.io/codeclimate/github/amazing-print/amazing_print.svg?style=flat
356
- [code_climate_coverage_badge]: https://codeclimate.com/github/amazing-print/amazing_print/badges/coverage.svg
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler/setup'
3
5
 
data/lib/amazing_print.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.
@@ -8,39 +10,39 @@
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|
12
- require "amazing_print/core_ext/#{file}"
13
+ %w[awesome_method_array string object class kernel].each do |file|
14
+ require_relative "amazing_print/core_ext/#{file}"
13
15
  end
14
16
 
15
- require 'amazing_print/custom_defaults'
16
- require 'amazing_print/inspector'
17
- require 'amazing_print/formatter'
18
- require 'amazing_print/version'
19
- require 'amazing_print/core_ext/logger' if defined?(Logger)
17
+ require_relative 'amazing_print/custom_defaults'
18
+ require_relative 'amazing_print/inspector'
19
+ require_relative 'amazing_print/formatter'
20
+ require_relative 'amazing_print/version'
21
+ require_relative 'amazing_print/core_ext/logger' if defined?(Logger)
20
22
  #
21
23
  # Load the following under normal circumstances as well as in Rails
22
24
  # console when required from ~/.irbrc or ~/.pryrc.
23
25
  #
24
26
  if defined?(ActiveRecord) || AmazingPrint.rails_console?
25
- require 'amazing_print/ext/active_record'
27
+ require_relative 'amazing_print/ext/active_record'
26
28
  end
27
29
  if defined?(ActiveSupport) || AmazingPrint.rails_console?
28
- require 'amazing_print/ext/active_support'
30
+ require_relative 'amazing_print/ext/active_support'
29
31
  end
30
32
  #
31
33
  # Load remaining extensions.
32
34
  #
33
35
  if defined?(ActiveSupport.on_load)
34
36
  ActiveSupport.on_load(:action_view) do
35
- require 'amazing_print/ext/action_view'
37
+ require_relative 'amazing_print/ext/action_view'
36
38
  end
37
39
  end
38
- require 'amazing_print/ext/mongo_mapper' if defined?(MongoMapper)
39
- require 'amazing_print/ext/mongoid' if defined?(Mongoid)
40
- require 'amazing_print/ext/nokogiri' if defined?(Nokogiri)
41
- require 'amazing_print/ext/nobrainer' if defined?(NoBrainer)
42
- require 'amazing_print/ext/ripple' if defined?(Ripple)
43
- require 'amazing_print/ext/sequel' if defined?(Sequel)
44
- require 'amazing_print/ext/ostruct' if defined?(OpenStruct)
40
+ require_relative 'amazing_print/ext/mongo_mapper' if defined?(MongoMapper)
41
+ require_relative 'amazing_print/ext/mongoid' if defined?(Mongoid)
42
+ require_relative 'amazing_print/ext/nokogiri' if defined?(Nokogiri)
43
+ require_relative 'amazing_print/ext/nobrainer' if defined?(NoBrainer)
44
+ require_relative 'amazing_print/ext/ripple' if defined?(Ripple)
45
+ require_relative 'amazing_print/ext/sequel' if defined?(Sequel)
46
+ require_relative 'amazing_print/ext/ostruct' if defined?(OpenStruct)
45
47
  end
46
48
  # test
@@ -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.
@@ -7,10 +9,17 @@ module AmazingPrint
7
9
  module Logger
8
10
  # Add ap method to logger
9
11
  #------------------------------------------------------------------------------
10
- def ap(object, level = nil)
12
+ def ap(object, options = {})
13
+ if options.is_a?(Hash)
14
+ level = options.delete(:level)
15
+ else
16
+ level = options
17
+ options = {}
18
+ end
19
+
11
20
  level ||= AmazingPrint.defaults[:log_level] if AmazingPrint.defaults
12
21
  level ||= :debug
13
- send level, object.ai
22
+ send level, object.ai(options)
14
23
  end
15
24
  end
16
25
  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,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
@@ -27,7 +29,7 @@ module AmazingPrint
27
29
 
28
30
  def usual_rb
29
31
  IRB::Irb.class_eval do
30
- def output_value
32
+ def output_value(_omit = false)
31
33
  ap @context.last_value
32
34
  rescue NoMethodError
33
35
  puts "(Object doesn't support #ai)"
@@ -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.
@@ -12,7 +14,7 @@ module AmazingPrint
12
14
  ).sub(
13
15
  /^<pre([\s>])/,
14
16
  '<pre class="debug_dump"\\1'
15
- )
17
+ ).html_safe
16
18
  end
17
19
 
18
20
  alias ap ap_debug