amazing_print 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +16 -0
- data/CHANGELOG.md +54 -37
- data/Gemfile +4 -1
- data/Gemfile.lock +38 -27
- data/README.md +2 -2
- data/lib/amazing_print/core_ext/awesome_method_array.rb +1 -1
- data/lib/amazing_print/custom_defaults.rb +7 -1
- data/lib/amazing_print/ext/mongoid.rb +14 -2
- data/lib/amazing_print/ext_loader.rb +27 -0
- data/lib/amazing_print/formatters/base_formatter.rb +8 -3
- data/lib/amazing_print/formatters/hash_formatter.rb +1 -4
- data/lib/amazing_print/inspector.rb +5 -2
- data/lib/amazing_print/version.rb +1 -1
- data/lib/amazing_print.rb +2 -8
- data/spec/ext/action_controller_spec.rb +3 -3
- data/spec/ext/active_record_spec.rb +6 -2
- data/spec/ext/active_support_spec.rb +2 -2
- data/spec/ext/mongoid_spec.rb +110 -47
- data/spec/ext/nokogiri_spec.rb +2 -2
- data/spec/formats_spec.rb +27 -24
- data/spec/misc_spec.rb +1 -1
- data/spec/support/active_record_data/7_0_diana.txt +110 -0
- data/spec/support/active_record_data/7_0_multi.txt +222 -0
- data/spec/support/rails_versions.rb +5 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 114d8297770972541aa0e40c8dd8fbc8dccf658089fe2b69d272fac2994b9621
|
4
|
+
data.tar.gz: 4e26b60b130dfe0b8eb4ebfe1d91f61cb3ca3de60d07ce0166650257bf83bce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1890155df4d922d6975a3ddca5c229a2d6f3c1326cc82836bea4816a068dade724f1dfcaadc8697b213474908fc17671aa75dc79d1758cbe378509267440534
|
7
|
+
data.tar.gz: 270b1f75b7aa990b103325f69468ea985c29a09f5b23450cc0e7b9a600a5f3a3ea6805c813151e1b584801195784fd604e30881dae9fd1e2ab1107c769eadd52
|
data/Appraisals
CHANGED
@@ -37,6 +37,22 @@ if RUBY_VERSION < '3'
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
if RUBY_VERSION >= '2.7'
|
41
|
+
appraise 'rails-7.0' do
|
42
|
+
gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0', platform: :jruby
|
43
|
+
gem 'rails', '~> 7.0.0'
|
44
|
+
gem 'sqlite3', platform: :mri
|
45
|
+
end
|
46
|
+
|
47
|
+
appraise 'mongoid-7.0' do
|
48
|
+
gem 'mongoid', '~> 7.0.0'
|
49
|
+
end
|
50
|
+
|
51
|
+
appraise 'mongoid-8.0' do
|
52
|
+
gem 'mongoid', '~> 8.0.0'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
40
56
|
appraise 'rails-6.1' do
|
41
57
|
gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0', platform: :jruby
|
42
58
|
gem 'rails', '~> 6.1.0'
|
data/CHANGELOG.md
CHANGED
@@ -1,58 +1,75 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
1
3
|
## Unreleased
|
2
4
|
|
5
|
+
## V1.6.0
|
6
|
+
|
7
|
+
- Use pager with Pry #96
|
8
|
+
- Add Rails 7 appraisal #98
|
9
|
+
- Allow Hash keys to be colorized #99
|
10
|
+
- Use CI merge queue #104
|
11
|
+
- Add support for Ruby 3.3 #105
|
12
|
+
- Add Mongoid field aliases #106
|
13
|
+
- Add bigdecimal gem #109
|
14
|
+
- Add ExtLoader to help with require order issues #110
|
15
|
+
|
3
16
|
## v1.5.0
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
17
|
+
|
18
|
+
- Drop support for Ruby 2.3 and 2.4 as well as JRuby 9.1
|
19
|
+
- Add File/Dir formatters for mswin platform #48
|
20
|
+
- Don't monkey patch String class #91
|
21
|
+
- Fix ruby19 hash syntax so it can be copy-pasted #94
|
8
22
|
|
9
23
|
## v1.4.0
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
24
|
+
|
25
|
+
- Support loading config from `$XDG_CONFIG_HOME/aprc` - #63
|
26
|
+
- Remove support for Rails 5.1 #75
|
27
|
+
- Update AR specs for Ruby 2.6.7 #76
|
28
|
+
- Load .aprc configs only once. #74
|
29
|
+
- Add XDG config support #77
|
30
|
+
- Rubocop updates #79
|
31
|
+
- Update Irb integration for v1.2.6+ #81
|
17
32
|
|
18
33
|
## v1.3.0
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
34
|
+
|
35
|
+
- Fix HTML escaping problems #53
|
36
|
+
- Update test suite for Ruby 2.7.2 and JRuby #61
|
37
|
+
- Add ActionView spec for html_safe #65
|
38
|
+
- Add support for Rails 6.1 #68
|
39
|
+
- Update specs for Ruby 3.0 #69
|
24
40
|
|
25
41
|
## v1.2.2
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
42
|
+
|
43
|
+
- Support Ruby 3.0 / IRB 1.2.6 - #57
|
44
|
+
- Fix FrozenError - #51
|
45
|
+
- Drop support for Ruby 2.3 and 2.4 as well as JRuby 9.1 - #46
|
46
|
+
- Add passing of `options` to `Logger#ap` - #55
|
30
47
|
|
31
48
|
## v1.2.1
|
32
|
-
- Correctly print active_model_errors for models that don't have tables - #42 by sahglie
|
33
|
-
- Update AmazingPrint::MongoMapper for frozen strings - #44
|
34
49
|
|
35
|
-
|
50
|
+
- Correctly print active_model_errors for models that don't have tables - #42 by sahglie
|
51
|
+
- Update AmazingPrint::MongoMapper for frozen strings - #44
|
36
52
|
|
37
|
-
|
38
|
-
- Add uncolor String method to remove ANSI color codes - #30 by duffyjp
|
39
|
-
- Restore original copyright - #33 by amarshall
|
40
|
-
- Remove method core extension since it is not needed since ruby 1.9 - #37 by grosser
|
41
|
-
- Remove pale and black string color aliases - #38
|
42
|
-
- Fix formatting ActionController::Parameters - #29
|
53
|
+
## v1.2.0
|
43
54
|
|
55
|
+
- Fix frozen string literal issue with ActiveRecord
|
56
|
+
- Add uncolor String method to remove ANSI color codes - #30 by duffyjp
|
57
|
+
- Restore original copyright - #33 by amarshall
|
58
|
+
- Remove method core extension since it is not needed since ruby 1.9 - #37 by grosser
|
59
|
+
- Remove pale and black string color aliases - #38
|
60
|
+
- Fix formatting ActionController::Parameters - #29
|
44
61
|
|
45
62
|
## v1.1.0
|
46
|
-
- Print out method keyword arguments
|
47
|
-
- Fix NoMethodError with Sequel
|
48
|
-
- Code cleanups
|
49
|
-
|
50
|
-
Thanks for the great contributions from:
|
51
63
|
|
52
|
-
|
53
|
-
|
64
|
+
- Print out method keyword arguments
|
65
|
+
- Fix NoMethodError with Sequel
|
66
|
+
- Code cleanups
|
54
67
|
|
68
|
+
Thanks for the great contributions from:
|
55
69
|
|
70
|
+
- andydna
|
71
|
+
- beanieboi
|
56
72
|
|
57
73
|
## v1.0.0
|
58
|
-
|
74
|
+
|
75
|
+
- Initial Release.
|
data/Gemfile
CHANGED
@@ -6,7 +6,10 @@ source 'https://rubygems.org'
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
# Development dependencies
|
9
|
-
|
9
|
+
# Update this once https://github.com/thoughtbot/appraisal/pull/202 is released
|
10
|
+
gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git', branch: :main
|
11
|
+
|
12
|
+
gem 'bigdecimal'
|
10
13
|
gem 'fakefs', '~> 1.2'
|
11
14
|
gem 'nokogiri', '~> 1.10'
|
12
15
|
gem 'pry'
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/thoughtbot/appraisal.git
|
3
|
+
revision: feb78bcc6177038399bff098cb6c2bd4bca4972a
|
4
|
+
branch: main
|
5
|
+
specs:
|
6
|
+
appraisal (2.5.0)
|
7
|
+
bundler
|
8
|
+
rake
|
9
|
+
thor (>= 0.14.0)
|
10
|
+
|
1
11
|
PATH
|
2
12
|
remote: .
|
3
13
|
specs:
|
@@ -6,29 +16,28 @@ PATH
|
|
6
16
|
GEM
|
7
17
|
remote: https://rubygems.org/
|
8
18
|
specs:
|
9
|
-
appraisal (2.4.1)
|
10
|
-
bundler
|
11
|
-
rake
|
12
|
-
thor (>= 0.14.0)
|
13
19
|
ast (2.4.2)
|
20
|
+
bigdecimal (3.1.6)
|
14
21
|
coderay (1.1.3)
|
15
22
|
diff-lcs (1.5.0)
|
16
23
|
fakefs (1.9.0)
|
17
|
-
json (2.
|
24
|
+
json (2.7.1)
|
25
|
+
language_server-protocol (3.17.0.3)
|
18
26
|
method_source (1.0.0)
|
19
|
-
nokogiri (1.
|
27
|
+
nokogiri (1.16.0-x86_64-linux)
|
20
28
|
racc (~> 1.4)
|
21
|
-
parallel (1.
|
22
|
-
parser (3.
|
29
|
+
parallel (1.24.0)
|
30
|
+
parser (3.3.0.2)
|
23
31
|
ast (~> 2.4.1)
|
32
|
+
racc
|
24
33
|
pry (0.14.2)
|
25
34
|
coderay (~> 1.1)
|
26
35
|
method_source (~> 1.0)
|
27
|
-
racc (1.
|
36
|
+
racc (1.7.3)
|
28
37
|
rainbow (3.1.1)
|
29
|
-
rake (13.0
|
30
|
-
regexp_parser (2.
|
31
|
-
rexml (3.2.
|
38
|
+
rake (13.1.0)
|
39
|
+
regexp_parser (2.9.0)
|
40
|
+
rexml (3.2.6)
|
32
41
|
rspec (3.12.0)
|
33
42
|
rspec-core (~> 3.12.0)
|
34
43
|
rspec-expectations (~> 3.12.0)
|
@@ -38,40 +47,42 @@ GEM
|
|
38
47
|
rspec-expectations (3.12.3)
|
39
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
49
|
rspec-support (~> 3.12.0)
|
41
|
-
rspec-mocks (3.12.
|
50
|
+
rspec-mocks (3.12.6)
|
42
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
52
|
rspec-support (~> 3.12.0)
|
44
|
-
rspec-support (3.12.
|
45
|
-
rubocop (1.
|
53
|
+
rspec-support (3.12.1)
|
54
|
+
rubocop (1.59.0)
|
46
55
|
json (~> 2.3)
|
56
|
+
language_server-protocol (>= 3.17.0)
|
47
57
|
parallel (~> 1.10)
|
48
|
-
parser (>= 3.2.
|
58
|
+
parser (>= 3.2.2.4)
|
49
59
|
rainbow (>= 2.2.2, < 4.0)
|
50
60
|
regexp_parser (>= 1.8, < 3.0)
|
51
61
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
62
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
53
63
|
ruby-progressbar (~> 1.7)
|
54
64
|
unicode-display_width (>= 2.4.0, < 3.0)
|
55
|
-
rubocop-ast (1.
|
65
|
+
rubocop-ast (1.30.0)
|
56
66
|
parser (>= 3.2.1.0)
|
57
|
-
rubocop-capybara (2.
|
67
|
+
rubocop-capybara (2.20.0)
|
68
|
+
rubocop (~> 1.41)
|
69
|
+
rubocop-factory_bot (2.25.1)
|
58
70
|
rubocop (~> 1.41)
|
59
|
-
rubocop-
|
60
|
-
rubocop (~> 1.
|
61
|
-
rubocop-rspec (2.22.0)
|
62
|
-
rubocop (~> 1.33)
|
71
|
+
rubocop-rspec (2.26.1)
|
72
|
+
rubocop (~> 1.40)
|
63
73
|
rubocop-capybara (~> 2.17)
|
64
74
|
rubocop-factory_bot (~> 2.22)
|
65
75
|
ruby-progressbar (1.13.0)
|
66
|
-
thor (1.
|
67
|
-
unicode-display_width (2.
|
76
|
+
thor (1.3.0)
|
77
|
+
unicode-display_width (2.5.0)
|
68
78
|
|
69
79
|
PLATFORMS
|
70
80
|
x86_64-linux
|
71
81
|
|
72
82
|
DEPENDENCIES
|
73
83
|
amazing_print!
|
74
|
-
appraisal
|
84
|
+
appraisal!
|
85
|
+
bigdecimal
|
75
86
|
fakefs (~> 1.2)
|
76
87
|
nokogiri (~> 1.10)
|
77
88
|
pry
|
@@ -80,4 +91,4 @@ DEPENDENCIES
|
|
80
91
|
rubocop-rspec (~> 2.4)
|
81
92
|
|
82
93
|
BUNDLED WITH
|
83
|
-
2.
|
94
|
+
2.5.4
|
data/README.md
CHANGED
@@ -315,11 +315,11 @@ formatting:
|
|
315
315
|
|
316
316
|
<%= ap @accounts.first, :html => true %>
|
317
317
|
|
318
|
-
###
|
318
|
+
### Colorizing Strings ###
|
319
319
|
Use methods such as `.red` to set string color:
|
320
320
|
|
321
321
|
```ruby
|
322
|
-
irb> puts "red text"
|
322
|
+
irb> puts AmazingPrint::Colors.red("red text")
|
323
323
|
red text # (it's red)
|
324
324
|
```
|
325
325
|
|
@@ -78,7 +78,7 @@ module AwesomeMethodArray # :nodoc:
|
|
78
78
|
super(pattern)
|
79
79
|
end
|
80
80
|
arr.instance_variable_set(:@__awesome_methods__, instance_variable_get(:@__awesome_methods__))
|
81
|
-
arr.select! { |item|
|
81
|
+
arr.select! { |item| item.is_a?(Symbol) || item.is_a?(String) } # grep block might return crap.
|
82
82
|
arr
|
83
83
|
end
|
84
84
|
end
|
@@ -44,7 +44,13 @@ module AmazingPrint
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def pry!
|
47
|
-
|
47
|
+
return unless defined?(Pry)
|
48
|
+
|
49
|
+
Pry.print = proc do |_output, value, pry_instance|
|
50
|
+
pry_instance.pager.open do |pager|
|
51
|
+
pager.print "#{value.ai}\n"
|
52
|
+
end
|
53
|
+
end
|
48
54
|
end
|
49
55
|
|
50
56
|
##
|
@@ -33,8 +33,14 @@ module AmazingPrint
|
|
33
33
|
def awesome_mongoid_class(object)
|
34
34
|
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:fields)
|
35
35
|
|
36
|
+
aliases = object.aliased_fields.invert
|
36
37
|
data = object.fields.sort.each_with_object(::ActiveSupport::OrderedHash.new) do |c, hash|
|
37
|
-
|
38
|
+
name = c[1].name
|
39
|
+
alias_name = aliases[name] unless name == '_id'
|
40
|
+
printed_name = alias_name ? "#{alias_name}(#{name})" : name
|
41
|
+
|
42
|
+
hash[printed_name.to_sym] = (c[1].type || 'undefined').to_s.underscore.intern
|
43
|
+
hash
|
38
44
|
end
|
39
45
|
|
40
46
|
name = "class #{awesome_simple(object.to_s, :class)}"
|
@@ -48,8 +54,14 @@ module AmazingPrint
|
|
48
54
|
def awesome_mongoid_document(object)
|
49
55
|
return object.inspect unless defined?(::ActiveSupport::OrderedHash)
|
50
56
|
|
57
|
+
aliases = object.aliased_fields.invert
|
51
58
|
data = (object.attributes || {}).sort.each_with_object(::ActiveSupport::OrderedHash.new) do |c, hash|
|
52
|
-
|
59
|
+
name = c[0]
|
60
|
+
alias_name = aliases[name] unless name == '_id'
|
61
|
+
printed_name = alias_name ? "#{alias_name}(#{name})" : name
|
62
|
+
|
63
|
+
hash[printed_name.to_sym] = c[1]
|
64
|
+
hash
|
53
65
|
end
|
54
66
|
data = { errors: object.errors, attributes: data } unless object.errors.empty?
|
55
67
|
"#{object} #{awesome_hash(data)}"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AmazingPrint
|
4
|
+
##
|
5
|
+
# Attempt to load extensions up to 3 times since this library may be required
|
6
|
+
# before dependencies that we have extensions for.
|
7
|
+
#
|
8
|
+
class ExtLoader
|
9
|
+
EXT_LOAD_ATTEMPT_LIMIT = 3
|
10
|
+
|
11
|
+
@load_attemps = 0
|
12
|
+
|
13
|
+
def self.call
|
14
|
+
return if @load_attemps >= EXT_LOAD_ATTEMPT_LIMIT
|
15
|
+
|
16
|
+
require_relative 'ext/mongo_mapper' if defined?(MongoMapper)
|
17
|
+
require_relative 'ext/mongoid' if defined?(Mongoid)
|
18
|
+
require_relative 'ext/nobrainer' if defined?(NoBrainer)
|
19
|
+
require_relative 'ext/nokogiri' if defined?(Nokogiri)
|
20
|
+
require_relative 'ext/ostruct' if defined?(OpenStruct) # rubocop:disable Style/OpenStructUse
|
21
|
+
require_relative 'ext/ripple' if defined?(Ripple)
|
22
|
+
require_relative 'ext/sequel' if defined?(Sequel)
|
23
|
+
|
24
|
+
@load_attemps += 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -130,17 +130,22 @@ module AmazingPrint
|
|
130
130
|
def align(value, width)
|
131
131
|
if options[:multiline]
|
132
132
|
indent_option = options[:indent]
|
133
|
+
effective_width = width + value.size - colorless_size(value)
|
133
134
|
if indent_option.positive?
|
134
|
-
value.rjust(
|
135
|
+
value.rjust(effective_width)
|
135
136
|
elsif indent_option.zero?
|
136
|
-
"#{indent}#{value.ljust(
|
137
|
+
"#{indent}#{value.ljust(effective_width)}"
|
137
138
|
else
|
138
|
-
"#{indent(indentation + indent_option)}#{value.ljust(
|
139
|
+
"#{indent(indentation + indent_option)}#{value.ljust(effective_width)}"
|
139
140
|
end
|
140
141
|
else
|
141
142
|
value
|
142
143
|
end
|
143
144
|
end
|
145
|
+
|
146
|
+
def colorless_size(string)
|
147
|
+
string.gsub(/\e\[[\d;]+m/, '').size
|
148
|
+
end
|
144
149
|
end
|
145
150
|
end
|
146
151
|
end
|
@@ -66,7 +66,7 @@ module AmazingPrint
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def max_key_width(keys)
|
69
|
-
keys.map { |key, _value| key
|
69
|
+
keys.map { |key, _value| colorless_size(key) }.max || 0
|
70
70
|
end
|
71
71
|
|
72
72
|
def printable_keys
|
@@ -96,13 +96,10 @@ module AmazingPrint
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def plain_single_line
|
99
|
-
plain = options[:plain]
|
100
99
|
multiline = options[:multiline]
|
101
|
-
options[:plain] = true
|
102
100
|
options[:multiline] = false
|
103
101
|
yield
|
104
102
|
ensure
|
105
|
-
options[:plain] = plain
|
106
103
|
options[:multiline] = multiline
|
107
104
|
end
|
108
105
|
end
|
@@ -6,9 +6,10 @@
|
|
6
6
|
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
|
9
|
-
# rubocop:disable Metrics/ClassLength
|
9
|
+
# rubocop:disable Metrics/ClassLength, Metrics/MethodLength
|
10
10
|
|
11
11
|
require_relative 'indentator'
|
12
|
+
require_relative 'ext_loader'
|
12
13
|
|
13
14
|
module AmazingPrint
|
14
15
|
class Inspector
|
@@ -70,6 +71,8 @@ module AmazingPrint
|
|
70
71
|
@formatter = AmazingPrint::Formatter.new(self)
|
71
72
|
@indentator = AmazingPrint::Indentator.new(@options[:indent].abs)
|
72
73
|
Thread.current[AP] ||= []
|
74
|
+
|
75
|
+
ExtLoader.call
|
73
76
|
end
|
74
77
|
|
75
78
|
def current_indentation
|
@@ -196,4 +199,4 @@ module AmazingPrint
|
|
196
199
|
end
|
197
200
|
end
|
198
201
|
|
199
|
-
# rubocop:enable Metrics/ClassLength
|
202
|
+
# rubocop:enable Metrics/ClassLength, Metrics/MethodLength
|
data/lib/amazing_print.rb
CHANGED
@@ -33,12 +33,6 @@ unless defined?(AmazingPrint::Inspector)
|
|
33
33
|
require_relative 'amazing_print/ext/action_view'
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
|
-
|
38
|
-
require_relative 'amazing_print/ext/nokogiri' if defined?(Nokogiri)
|
39
|
-
require_relative 'amazing_print/ext/nobrainer' if defined?(NoBrainer)
|
40
|
-
require_relative 'amazing_print/ext/ripple' if defined?(Ripple)
|
41
|
-
require_relative 'amazing_print/ext/sequel' if defined?(Sequel)
|
42
|
-
require_relative 'amazing_print/ext/ostruct' if defined?(OpenStruct)
|
36
|
+
|
37
|
+
AmazingPrint::ExtLoader.call
|
43
38
|
end
|
44
|
-
# test
|
@@ -21,9 +21,9 @@ RSpec.describe 'AmazingPrint::ActionController', skip: -> { !ExtVerifier.has_rai
|
|
21
21
|
let(:expected_output) do
|
22
22
|
<<~OUTPUT
|
23
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
|
24
|
+
\e[0;33m"post"\e[0m\e[0;37m => \e[0m{
|
25
|
+
\e[0;33m"id"\e[0m\e[0;37m => \e[0m\e[1;34m1\e[0m,
|
26
|
+
\e[0;33m"content"\e[0m\e[0;37m => \e[0m\e[0;33m"Some"\e[0m
|
27
27
|
}
|
28
28
|
}
|
29
29
|
OUTPUT
|
@@ -114,7 +114,9 @@ RSpec.describe 'AmazingPrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }
|
|
114
114
|
out = @ap.awesome(@diana)
|
115
115
|
|
116
116
|
raw_object_string =
|
117
|
-
if
|
117
|
+
if activerecord_7_0?
|
118
|
+
ActiveRecordData.raw_7_0_diana
|
119
|
+
elsif activerecord_6_1?
|
118
120
|
ActiveRecordData.raw_6_1_diana
|
119
121
|
elsif activerecord_6_0?
|
120
122
|
ActiveRecordData.raw_6_0_diana
|
@@ -148,7 +150,9 @@ RSpec.describe 'AmazingPrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }
|
|
148
150
|
out = @ap.awesome([@diana, @laura])
|
149
151
|
|
150
152
|
raw_object_string =
|
151
|
-
if
|
153
|
+
if activerecord_7_0?
|
154
|
+
ActiveRecordData.raw_7_0_multi
|
155
|
+
elsif activerecord_6_1?
|
152
156
|
ActiveRecordData.raw_6_1_multi
|
153
157
|
elsif activerecord_6_0?
|
154
158
|
ActiveRecordData.raw_6_0_multi
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
RSpec.describe 'AmazingPrint::ActiveSupport', skip: -> { !ExtVerifier.has_rails? }.call do
|
6
6
|
let(:expected_ar_time_str) do
|
7
|
-
if activerecord_6_1?
|
7
|
+
if activerecord_6_1? || activerecord_7_0?
|
8
8
|
'15:30:45.000000000'
|
9
9
|
else
|
10
10
|
'15:30:45'
|
@@ -24,7 +24,7 @@ RSpec.describe 'AmazingPrint::ActiveSupport', skip: -> { !ExtVerifier.has_rails?
|
|
24
24
|
|
25
25
|
it 'formats HashWithIndifferentAccess as regular Hash' do
|
26
26
|
hash = HashWithIndifferentAccess.new({ hello: 'world' })
|
27
|
-
expect(@ap.send(:awesome, hash)).to eq("{\n \"hello\"\e[0;37m => \e[0m\e[0;33m\"world\"\e[0m\n}")
|
27
|
+
expect(@ap.send(:awesome, hash)).to eq("{\n \e[0;33m\"hello\"\e[0m\e[0;37m => \e[0m\e[0;33m\"world\"\e[0m\n}")
|
28
28
|
end
|
29
29
|
|
30
30
|
# ActiveSupport sticks in instance variables to the date object. Make sure
|
data/spec/ext/mongoid_spec.rb
CHANGED
@@ -5,67 +5,130 @@
|
|
5
5
|
require 'spec_helper'
|
6
6
|
|
7
7
|
RSpec.describe 'AmazingPrint/Mongoid', skip: -> { !ExtVerifier.has_mongoid? }.call do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
include Mongoid::Document
|
8
|
+
before do
|
9
|
+
@ap = AmazingPrint::Inspector.new plain: true, sort_keys: true
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
describe 'Document' do
|
13
|
+
if ExtVerifier.has_mongoid?
|
14
|
+
before :all do
|
15
|
+
class MongoUser
|
16
|
+
include Mongoid::Document
|
17
|
+
|
18
|
+
field :first_name, type: String
|
19
|
+
field :last_name, type: String
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
after :all do
|
24
|
+
Object.instance_eval { remove_const :MongoUser }
|
25
|
+
Object.instance_eval { remove_const :Chamelion }
|
15
26
|
end
|
16
27
|
end
|
17
28
|
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
it 'prints class instance' do
|
30
|
+
user = MongoUser.new first_name: 'Al', last_name: 'Capone'
|
31
|
+
out = @ap.send :awesome, user
|
32
|
+
|
33
|
+
object_id = user.id.inspect
|
34
|
+
str = <<~EOS.strip
|
35
|
+
#<MongoUser:placeholder_id> {
|
36
|
+
:_id => #{object_id},
|
37
|
+
:first_name => "Al",
|
38
|
+
:last_name => "Capone"
|
39
|
+
}
|
40
|
+
EOS
|
41
|
+
expect(out).to be_similar_to(str, { skip_bson: true })
|
21
42
|
end
|
22
|
-
end
|
23
43
|
|
24
|
-
|
25
|
-
|
26
|
-
|
44
|
+
it 'prints the class' do
|
45
|
+
class_spec = <<~EOS.strip
|
46
|
+
class MongoUser < Object {
|
47
|
+
:_id => :"bson/object_id",
|
48
|
+
:first_name => :string,
|
49
|
+
:last_name => :string
|
50
|
+
}
|
51
|
+
EOS
|
27
52
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
:first_name => "Al",
|
37
|
-
:last_name => "Capone"
|
38
|
-
}
|
39
|
-
EOS
|
40
|
-
expect(out).to be_similar_to(str, { skip_bson: true })
|
41
|
-
end
|
53
|
+
expect(@ap.send(:awesome, MongoUser)).to eq class_spec
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'prints the class when type is undefined' do
|
57
|
+
class Chamelion
|
58
|
+
include Mongoid::Document
|
59
|
+
field :last_attribute
|
60
|
+
end
|
42
61
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
EOS
|
62
|
+
class_spec = <<~EOS.strip
|
63
|
+
class Chamelion < Object {
|
64
|
+
:_id => :"bson/object_id",
|
65
|
+
:last_attribute => :object
|
66
|
+
}
|
67
|
+
EOS
|
51
68
|
|
52
|
-
|
69
|
+
expect(@ap.send(:awesome, Chamelion)).to eq class_spec
|
70
|
+
end
|
53
71
|
end
|
54
72
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
73
|
+
describe 'Document with aliased fields' do
|
74
|
+
if ExtVerifier.has_mongoid?
|
75
|
+
before :all do
|
76
|
+
class MongoUser
|
77
|
+
include Mongoid::Document
|
78
|
+
|
79
|
+
field :fn, as: :first_name, type: String
|
80
|
+
field :ln, as: :last_name, type: String
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
after :all do
|
85
|
+
Object.instance_eval { remove_const :MongoUser }
|
86
|
+
Object.instance_eval { remove_const :Chamelion }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'prints class instance' do
|
91
|
+
user = MongoUser.new first_name: 'Al', last_name: 'Capone'
|
92
|
+
out = @ap.send :awesome, user
|
93
|
+
|
94
|
+
object_id = user.id.inspect
|
95
|
+
str = <<~EOS.strip
|
96
|
+
#<MongoUser:placeholder_id> {
|
97
|
+
:_id => #{object_id},
|
98
|
+
:"first_name(fn)" => "Al",
|
99
|
+
:"last_name(ln)" => "Capone"
|
100
|
+
}
|
101
|
+
EOS
|
102
|
+
expect(out).to be_similar_to(str, { skip_bson: true })
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'prints the class' do
|
106
|
+
class_spec = <<~EOS.strip
|
107
|
+
class MongoUser < Object {
|
108
|
+
:_id => :"bson/object_id",
|
109
|
+
:"first_name(fn)" => :string,
|
110
|
+
:"last_name(ln)" => :string
|
111
|
+
}
|
112
|
+
EOS
|
113
|
+
|
114
|
+
expect(@ap.send(:awesome, MongoUser)).to eq class_spec
|
59
115
|
end
|
60
116
|
|
61
|
-
|
62
|
-
class Chamelion
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
EOS
|
117
|
+
it 'prints the class when type is undefined' do
|
118
|
+
class Chamelion
|
119
|
+
include Mongoid::Document
|
120
|
+
field :la, as: :last_attribute
|
121
|
+
end
|
67
122
|
|
68
|
-
|
123
|
+
class_spec = <<~EOS.strip
|
124
|
+
class Chamelion < Object {
|
125
|
+
:_id => :"bson/object_id",
|
126
|
+
:"last_attribute(la)" => :object
|
127
|
+
}
|
128
|
+
EOS
|
129
|
+
|
130
|
+
expect(@ap.send(:awesome, Chamelion)).to eq class_spec
|
131
|
+
end
|
69
132
|
end
|
70
133
|
end
|
71
134
|
|
data/spec/ext/nokogiri_spec.rb
CHANGED
@@ -6,7 +6,7 @@ RSpec.describe 'AmazingPrint/Nokogiri' do
|
|
6
6
|
it 'colorizes tags' do
|
7
7
|
xml = Nokogiri::XML('<html><body><h1></h1></body></html>')
|
8
8
|
# FIXME: Due to something strange with Nokogiri and JRuby, we need to remove extra blank lines.
|
9
|
-
output = xml.ai.gsub(
|
9
|
+
output = xml.ai.gsub("\n\n", "\n")
|
10
10
|
expect(output).to eq <<~EOS
|
11
11
|
<?xml version="1.0"?>\e[1;32m
|
12
12
|
\e[0m<\e[1;36mhtml\e[0m>\e[1;32m
|
@@ -32,7 +32,7 @@ RSpec.describe 'AmazingPrint/Nokogiri' do
|
|
32
32
|
it 'colorizes class and id' do
|
33
33
|
xml = Nokogiri::XML('<html><body><h1><span class="world" id="hello"></span></h1></body></html>')
|
34
34
|
# FIXME: Due to something strange with Nokogiri and JRuby, we need to remove extra blank lines.
|
35
|
-
output = xml.ai.gsub(
|
35
|
+
output = xml.ai.gsub("\n\n", "\n")
|
36
36
|
expect(output).to eq <<~EOS
|
37
37
|
<?xml version="1.0"?>\e[1;32m
|
38
38
|
\e[0m<\e[1;36mhtml\e[0m>\e[1;32m
|
data/spec/formats_spec.rb
CHANGED
@@ -314,11 +314,11 @@ RSpec.describe 'AmazingPrint' do
|
|
314
314
|
it 'colored multiline (default)' do
|
315
315
|
expect(@hash.ai).to eq <<~EOS.strip
|
316
316
|
{
|
317
|
-
1\e[0;37m => \e[0m{
|
318
|
-
:sym\e[0;37m => \e[0m{
|
319
|
-
"str"\e[0;37m => \e[0m{
|
320
|
-
[ 1,
|
321
|
-
{ :k => :v }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
317
|
+
\e[1;34m1\e[0m\e[0;37m => \e[0m{
|
318
|
+
\e[0;36m:sym\e[0m\e[0;37m => \e[0m{
|
319
|
+
\e[0;33m"str"\e[0m\e[0;37m => \e[0m{
|
320
|
+
[ \e[1;34m1\e[0m, \e[1;34m2\e[0m, \e[1;34m3\e[0m ]\e[0;37m => \e[0m{
|
321
|
+
{ \e[0;36m:k\e[0m\e[0;37m => \e[0m\e[0;36m:v\e[0m }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
322
322
|
}
|
323
323
|
}
|
324
324
|
}
|
@@ -330,11 +330,11 @@ RSpec.describe 'AmazingPrint' do
|
|
330
330
|
it 'colored with new hash syntax' do
|
331
331
|
expect(@hash.ai(ruby19_syntax: true)).to eq <<~EOS.strip
|
332
332
|
{
|
333
|
-
1\e[0;37m => \e[0m{
|
334
|
-
sym
|
335
|
-
"str"\e[0;37m => \e[0m{
|
336
|
-
[ 1,
|
337
|
-
{ k
|
333
|
+
\e[1;34m1\e[0m\e[0;37m => \e[0m{
|
334
|
+
\e[0;36m:sym\e[0m\e[0;37m => \e[0m{
|
335
|
+
\e[0;33m"str"\e[0m\e[0;37m => \e[0m{
|
336
|
+
[ \e[1;34m1\e[0m, \e[1;34m2\e[0m, \e[1;34m3\e[0m ]\e[0;37m => \e[0m{
|
337
|
+
{ \e[0;36m:k\e[0m\e[0;37m => \e[0m\e[0;36m:v\e[0m }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
338
338
|
}
|
339
339
|
}
|
340
340
|
}
|
@@ -346,11 +346,11 @@ RSpec.describe 'AmazingPrint' do
|
|
346
346
|
it 'colored multiline indented' do
|
347
347
|
expect(@hash.ai(indent: 2)).to eq <<~EOS.strip
|
348
348
|
{
|
349
|
-
1\e[0;37m => \e[0m{
|
350
|
-
:sym\e[0;37m => \e[0m{
|
351
|
-
"str"\e[0;37m => \e[0m{
|
352
|
-
[ 1,
|
353
|
-
{ :k => :v }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
349
|
+
\e[1;34m1\e[0m\e[0;37m => \e[0m{
|
350
|
+
\e[0;36m:sym\e[0m\e[0;37m => \e[0m{
|
351
|
+
\e[0;33m"str"\e[0m\e[0;37m => \e[0m{
|
352
|
+
[ \e[1;34m1\e[0m, \e[1;34m2\e[0m, \e[1;34m3\e[0m ]\e[0;37m => \e[0m{
|
353
|
+
{ \e[0;36m:k\e[0m\e[0;37m => \e[0m\e[0;36m:v\e[0m }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
354
354
|
}
|
355
355
|
}
|
356
356
|
}
|
@@ -360,7 +360,10 @@ RSpec.describe 'AmazingPrint' do
|
|
360
360
|
end
|
361
361
|
|
362
362
|
it 'colored single line' do
|
363
|
-
|
363
|
+
puts @hash.ai(multiline: false)
|
364
|
+
expect(@hash.ai(multiline: false)).to eq(
|
365
|
+
"{ \e[1;34m1\e[0m\e[0;37m => \e[0m{ \e[0;36m:sym\e[0m\e[0;37m => \e[0m{ \e[0;33m\"str\"\e[0m\e[0;37m => \e[0m{ [ \e[1;34m1\e[0m, \e[1;34m2\e[0m, \e[1;34m3\e[0m ]\e[0;37m => \e[0m{ { \e[0;36m:k\e[0m\e[0;37m => \e[0m\e[0;36m:v\e[0m }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m } } } } }" # rubocop:disable Layout/LineLength
|
366
|
+
)
|
364
367
|
end
|
365
368
|
end
|
366
369
|
|
@@ -499,13 +502,13 @@ RSpec.describe 'AmazingPrint' do
|
|
499
502
|
|
500
503
|
#------------------------------------------------------------------------------
|
501
504
|
describe 'File' do
|
502
|
-
it 'displays a file (plain)', unix
|
505
|
+
it 'displays a file (plain)', :unix do
|
503
506
|
File.open(__FILE__, 'r') do |f|
|
504
507
|
expect(f.ai(plain: true)).to eq("#{f.inspect}\n" + `ls -alF #{f.path}`.chop)
|
505
508
|
end
|
506
509
|
end
|
507
510
|
|
508
|
-
it 'displays a file (plain) akin to powershell Get-ChildItem', mswin
|
511
|
+
it 'displays a file (plain) akin to powershell Get-ChildItem', :mswin do
|
509
512
|
File.open(__FILE__, 'r') do |f|
|
510
513
|
expect(f.ai(plain: true)).to eq("#{f.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(f.path).to_s)
|
511
514
|
end
|
@@ -514,13 +517,13 @@ RSpec.describe 'AmazingPrint' do
|
|
514
517
|
|
515
518
|
#------------------------------------------------------------------------------
|
516
519
|
describe 'Dir' do
|
517
|
-
it 'displays a direcory (plain)', unix
|
520
|
+
it 'displays a direcory (plain)', :unix do
|
518
521
|
Dir.open(File.dirname(__FILE__)) do |d|
|
519
522
|
expect(d.ai(plain: true)).to eq("#{d.inspect}\n" + `ls -alF #{d.path}`.chop)
|
520
523
|
end
|
521
524
|
end
|
522
525
|
|
523
|
-
it 'displays a directory (plain) akin to powershell Get-ChildItem', mswin
|
526
|
+
it 'displays a directory (plain) akin to powershell Get-ChildItem', :mswin do
|
524
527
|
Dir.open(File.dirname(__FILE__)) do |d|
|
525
528
|
expect(d.ai(plain: true)).to eq("#{d.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(d.path).to_s)
|
526
529
|
end
|
@@ -684,7 +687,7 @@ RSpec.describe 'AmazingPrint' do
|
|
684
687
|
EOS
|
685
688
|
end
|
686
689
|
|
687
|
-
it 'inherited from File should be displayed as File', unix
|
690
|
+
it 'inherited from File should be displayed as File', :unix do
|
688
691
|
class My < File; end
|
689
692
|
|
690
693
|
my = begin
|
@@ -695,13 +698,13 @@ RSpec.describe 'AmazingPrint' do
|
|
695
698
|
expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop)
|
696
699
|
end
|
697
700
|
|
698
|
-
it 'inherited from File should be displayed as File', mswin
|
701
|
+
it 'inherited from File should be displayed as File', :mswin do
|
699
702
|
class My < File; end
|
700
703
|
my = My.new('nul') # it's /dev/null in Windows
|
701
704
|
expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(my.path).to_s)
|
702
705
|
end
|
703
706
|
|
704
|
-
it 'inherited from Dir should be displayed as Dir', unix
|
707
|
+
it 'inherited from Dir should be displayed as Dir', :unix do
|
705
708
|
class My < Dir; end
|
706
709
|
|
707
710
|
require 'tmpdir'
|
@@ -709,7 +712,7 @@ RSpec.describe 'AmazingPrint' do
|
|
709
712
|
expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop)
|
710
713
|
end
|
711
714
|
|
712
|
-
it 'inherited from Dir are displayed as Dir', mswin
|
715
|
+
it 'inherited from Dir are displayed as Dir', :mswin do
|
713
716
|
class My < Dir; end
|
714
717
|
|
715
718
|
require 'tmpdir'
|
data/spec/misc_spec.rb
CHANGED
@@ -103,7 +103,7 @@ RSpec.describe 'AmazingPrint' do
|
|
103
103
|
expect(markup.ai(html: true)).to eq <<~EOS.strip
|
104
104
|
<pre>[
|
105
105
|
<kbd style="color:white">[0] </kbd>{
|
106
|
-
|
106
|
+
<kbd style="color:brown">"hello"</kbd><kbd style="color:slategray"> => </kbd><kbd style="color:brown">"world"</kbd>
|
107
107
|
}
|
108
108
|
]</pre>
|
109
109
|
EOS
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#<User:placeholder_id
|
2
|
+
@_start_transaction_state = nil,
|
3
|
+
@association_cache = {},
|
4
|
+
@destroyed = false,
|
5
|
+
@marked_for_destruction = false,
|
6
|
+
@new_record = true,
|
7
|
+
@previously_new_record = false,
|
8
|
+
@primary_key = "id",
|
9
|
+
@readonly = false,
|
10
|
+
@strict_loading = false,
|
11
|
+
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
|
12
|
+
@attributes = {
|
13
|
+
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
14
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
15
|
+
@original_attribute = nil,
|
16
|
+
attr_reader :name = "admin",
|
17
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
18
|
+
attr_reader :limit = nil,
|
19
|
+
attr_reader :precision = nil,
|
20
|
+
attr_reader :scale = nil
|
21
|
+
>,
|
22
|
+
attr_reader :value_before_type_cast = nil
|
23
|
+
>,
|
24
|
+
attr_reader :name = "admin",
|
25
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
26
|
+
attr_reader :limit = nil,
|
27
|
+
attr_reader :precision = nil,
|
28
|
+
attr_reader :scale = nil
|
29
|
+
>,
|
30
|
+
attr_reader :value_before_type_cast = false
|
31
|
+
>,
|
32
|
+
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
33
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
34
|
+
@original_attribute = nil,
|
35
|
+
attr_reader :name = "created_at",
|
36
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
37
|
+
attr_reader :limit = nil,
|
38
|
+
attr_reader :precision = 6,
|
39
|
+
attr_reader :scale = nil
|
40
|
+
>,
|
41
|
+
attr_reader :value_before_type_cast = nil
|
42
|
+
>,
|
43
|
+
attr_reader :name = "created_at",
|
44
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
45
|
+
attr_reader :limit = nil,
|
46
|
+
attr_reader :precision = 6,
|
47
|
+
attr_reader :scale = nil
|
48
|
+
>,
|
49
|
+
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
|
50
|
+
>,
|
51
|
+
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
52
|
+
@original_attribute = nil,
|
53
|
+
attr_reader :name = "id",
|
54
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
55
|
+
@range = -9223372036854775808...9223372036854775808,
|
56
|
+
attr_reader :limit = nil,
|
57
|
+
attr_reader :precision = nil,
|
58
|
+
attr_reader :scale = nil
|
59
|
+
>,
|
60
|
+
attr_reader :value_before_type_cast = nil
|
61
|
+
>,
|
62
|
+
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
63
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
64
|
+
@original_attribute = nil,
|
65
|
+
attr_reader :name = "name",
|
66
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
67
|
+
@false = "f",
|
68
|
+
@true = "t",
|
69
|
+
attr_reader :limit = nil,
|
70
|
+
attr_reader :precision = nil,
|
71
|
+
attr_reader :scale = nil
|
72
|
+
>,
|
73
|
+
attr_reader :value_before_type_cast = nil
|
74
|
+
>,
|
75
|
+
attr_reader :name = "name",
|
76
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
77
|
+
@false = "f",
|
78
|
+
@true = "t",
|
79
|
+
attr_reader :limit = nil,
|
80
|
+
attr_reader :precision = nil,
|
81
|
+
attr_reader :scale = nil
|
82
|
+
>,
|
83
|
+
attr_reader :value_before_type_cast = "Diana"
|
84
|
+
>,
|
85
|
+
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
86
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
87
|
+
@original_attribute = nil,
|
88
|
+
attr_reader :name = "rank",
|
89
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
90
|
+
@range = -9223372036854775808...9223372036854775808,
|
91
|
+
attr_reader :limit = nil,
|
92
|
+
attr_reader :precision = nil,
|
93
|
+
attr_reader :scale = nil
|
94
|
+
>,
|
95
|
+
attr_reader :value_before_type_cast = nil
|
96
|
+
>,
|
97
|
+
attr_reader :name = "rank",
|
98
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
99
|
+
@range = -9223372036854775808...9223372036854775808,
|
100
|
+
attr_reader :limit = nil,
|
101
|
+
attr_reader :precision = nil,
|
102
|
+
attr_reader :scale = nil
|
103
|
+
>,
|
104
|
+
attr_reader :value_before_type_cast = 1
|
105
|
+
>
|
106
|
+
}
|
107
|
+
>,
|
108
|
+
attr_accessor :destroyed_by_association = nil,
|
109
|
+
attr_reader :strict_loading_mode = :all
|
110
|
+
>
|
@@ -0,0 +1,222 @@
|
|
1
|
+
[
|
2
|
+
[0] #<User:placeholder_id
|
3
|
+
@_start_transaction_state = nil,
|
4
|
+
@association_cache = {},
|
5
|
+
@destroyed = false,
|
6
|
+
@marked_for_destruction = false,
|
7
|
+
@new_record = true,
|
8
|
+
@previously_new_record = false,
|
9
|
+
@primary_key = "id",
|
10
|
+
@readonly = false,
|
11
|
+
@strict_loading = false,
|
12
|
+
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
|
13
|
+
@attributes = {
|
14
|
+
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
15
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
16
|
+
@original_attribute = nil,
|
17
|
+
attr_reader :name = "admin",
|
18
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
19
|
+
attr_reader :limit = nil,
|
20
|
+
attr_reader :precision = nil,
|
21
|
+
attr_reader :scale = nil
|
22
|
+
>,
|
23
|
+
attr_reader :value_before_type_cast = nil
|
24
|
+
>,
|
25
|
+
attr_reader :name = "admin",
|
26
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
27
|
+
attr_reader :limit = nil,
|
28
|
+
attr_reader :precision = nil,
|
29
|
+
attr_reader :scale = nil
|
30
|
+
>,
|
31
|
+
attr_reader :value_before_type_cast = false
|
32
|
+
>,
|
33
|
+
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
34
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
35
|
+
@original_attribute = nil,
|
36
|
+
attr_reader :name = "created_at",
|
37
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
38
|
+
attr_reader :limit = nil,
|
39
|
+
attr_reader :precision = 6,
|
40
|
+
attr_reader :scale = nil
|
41
|
+
>,
|
42
|
+
attr_reader :value_before_type_cast = nil
|
43
|
+
>,
|
44
|
+
attr_reader :name = "created_at",
|
45
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
46
|
+
attr_reader :limit = nil,
|
47
|
+
attr_reader :precision = 6,
|
48
|
+
attr_reader :scale = nil
|
49
|
+
>,
|
50
|
+
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
|
51
|
+
>,
|
52
|
+
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
53
|
+
@original_attribute = nil,
|
54
|
+
attr_reader :name = "id",
|
55
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
56
|
+
@range = -9223372036854775808...9223372036854775808,
|
57
|
+
attr_reader :limit = nil,
|
58
|
+
attr_reader :precision = nil,
|
59
|
+
attr_reader :scale = nil
|
60
|
+
>,
|
61
|
+
attr_reader :value_before_type_cast = nil
|
62
|
+
>,
|
63
|
+
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
64
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
65
|
+
@original_attribute = nil,
|
66
|
+
attr_reader :name = "name",
|
67
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
68
|
+
@false = "f",
|
69
|
+
@true = "t",
|
70
|
+
attr_reader :limit = nil,
|
71
|
+
attr_reader :precision = nil,
|
72
|
+
attr_reader :scale = nil
|
73
|
+
>,
|
74
|
+
attr_reader :value_before_type_cast = nil
|
75
|
+
>,
|
76
|
+
attr_reader :name = "name",
|
77
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
78
|
+
@false = "f",
|
79
|
+
@true = "t",
|
80
|
+
attr_reader :limit = nil,
|
81
|
+
attr_reader :precision = nil,
|
82
|
+
attr_reader :scale = nil
|
83
|
+
>,
|
84
|
+
attr_reader :value_before_type_cast = "Diana"
|
85
|
+
>,
|
86
|
+
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
87
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
88
|
+
@original_attribute = nil,
|
89
|
+
attr_reader :name = "rank",
|
90
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
91
|
+
@range = -9223372036854775808...9223372036854775808,
|
92
|
+
attr_reader :limit = nil,
|
93
|
+
attr_reader :precision = nil,
|
94
|
+
attr_reader :scale = nil
|
95
|
+
>,
|
96
|
+
attr_reader :value_before_type_cast = nil
|
97
|
+
>,
|
98
|
+
attr_reader :name = "rank",
|
99
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
100
|
+
@range = -9223372036854775808...9223372036854775808,
|
101
|
+
attr_reader :limit = nil,
|
102
|
+
attr_reader :precision = nil,
|
103
|
+
attr_reader :scale = nil
|
104
|
+
>,
|
105
|
+
attr_reader :value_before_type_cast = 1
|
106
|
+
>
|
107
|
+
}
|
108
|
+
>,
|
109
|
+
attr_accessor :destroyed_by_association = nil,
|
110
|
+
attr_reader :strict_loading_mode = :all
|
111
|
+
>,
|
112
|
+
[1] #<User:placeholder_id
|
113
|
+
@_start_transaction_state = nil,
|
114
|
+
@association_cache = {},
|
115
|
+
@destroyed = false,
|
116
|
+
@marked_for_destruction = false,
|
117
|
+
@new_record = true,
|
118
|
+
@previously_new_record = false,
|
119
|
+
@primary_key = "id",
|
120
|
+
@readonly = false,
|
121
|
+
@strict_loading = false,
|
122
|
+
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
|
123
|
+
@attributes = {
|
124
|
+
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
125
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
126
|
+
@original_attribute = nil,
|
127
|
+
attr_reader :name = "admin",
|
128
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
129
|
+
attr_reader :limit = nil,
|
130
|
+
attr_reader :precision = nil,
|
131
|
+
attr_reader :scale = nil
|
132
|
+
>,
|
133
|
+
attr_reader :value_before_type_cast = nil
|
134
|
+
>,
|
135
|
+
attr_reader :name = "admin",
|
136
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
137
|
+
attr_reader :limit = nil,
|
138
|
+
attr_reader :precision = nil,
|
139
|
+
attr_reader :scale = nil
|
140
|
+
>,
|
141
|
+
attr_reader :value_before_type_cast = true
|
142
|
+
>,
|
143
|
+
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
144
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
145
|
+
@original_attribute = nil,
|
146
|
+
attr_reader :name = "created_at",
|
147
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
148
|
+
attr_reader :limit = nil,
|
149
|
+
attr_reader :precision = 6,
|
150
|
+
attr_reader :scale = nil
|
151
|
+
>,
|
152
|
+
attr_reader :value_before_type_cast = nil
|
153
|
+
>,
|
154
|
+
attr_reader :name = "created_at",
|
155
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
156
|
+
attr_reader :limit = nil,
|
157
|
+
attr_reader :precision = 6,
|
158
|
+
attr_reader :scale = nil
|
159
|
+
>,
|
160
|
+
attr_reader :value_before_type_cast = "2003-05-26 14:15:00"
|
161
|
+
>,
|
162
|
+
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
163
|
+
@original_attribute = nil,
|
164
|
+
attr_reader :name = "id",
|
165
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
166
|
+
@range = -9223372036854775808...9223372036854775808,
|
167
|
+
attr_reader :limit = nil,
|
168
|
+
attr_reader :precision = nil,
|
169
|
+
attr_reader :scale = nil
|
170
|
+
>,
|
171
|
+
attr_reader :value_before_type_cast = nil
|
172
|
+
>,
|
173
|
+
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
174
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
175
|
+
@original_attribute = nil,
|
176
|
+
attr_reader :name = "name",
|
177
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
178
|
+
@false = "f",
|
179
|
+
@true = "t",
|
180
|
+
attr_reader :limit = nil,
|
181
|
+
attr_reader :precision = nil,
|
182
|
+
attr_reader :scale = nil
|
183
|
+
>,
|
184
|
+
attr_reader :value_before_type_cast = nil
|
185
|
+
>,
|
186
|
+
attr_reader :name = "name",
|
187
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
188
|
+
@false = "f",
|
189
|
+
@true = "t",
|
190
|
+
attr_reader :limit = nil,
|
191
|
+
attr_reader :precision = nil,
|
192
|
+
attr_reader :scale = nil
|
193
|
+
>,
|
194
|
+
attr_reader :value_before_type_cast = "Laura"
|
195
|
+
>,
|
196
|
+
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
|
197
|
+
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
|
198
|
+
@original_attribute = nil,
|
199
|
+
attr_reader :name = "rank",
|
200
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
201
|
+
@range = -9223372036854775808...9223372036854775808,
|
202
|
+
attr_reader :limit = nil,
|
203
|
+
attr_reader :precision = nil,
|
204
|
+
attr_reader :scale = nil
|
205
|
+
>,
|
206
|
+
attr_reader :value_before_type_cast = nil
|
207
|
+
>,
|
208
|
+
attr_reader :name = "rank",
|
209
|
+
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
|
210
|
+
@range = -9223372036854775808...9223372036854775808,
|
211
|
+
attr_reader :limit = nil,
|
212
|
+
attr_reader :precision = nil,
|
213
|
+
attr_reader :scale = nil
|
214
|
+
>,
|
215
|
+
attr_reader :value_before_type_cast = 2
|
216
|
+
>
|
217
|
+
}
|
218
|
+
>,
|
219
|
+
attr_accessor :destroyed_by_association = nil,
|
220
|
+
attr_reader :strict_loading_mode = :all
|
221
|
+
>
|
222
|
+
]
|
@@ -5,6 +5,11 @@ module RailsVersions
|
|
5
5
|
Gem::Version.new(Rails::VERSION::STRING)
|
6
6
|
end
|
7
7
|
|
8
|
+
def rails_7_0?
|
9
|
+
Gem::Requirement.new('~> 7.0.0').satisfied_by?(rails_version)
|
10
|
+
end
|
11
|
+
alias activerecord_7_0? rails_7_0?
|
12
|
+
|
8
13
|
def rails_6_1?
|
9
14
|
Gem::Requirement.new('~> 6.1.0').satisfied_by?(rails_version)
|
10
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazing_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dvorkin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
|
15
15
|
their structure. Supports custom object formatting via plugins'
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- lib/amazing_print/ext/ostruct.rb
|
47
47
|
- lib/amazing_print/ext/ripple.rb
|
48
48
|
- lib/amazing_print/ext/sequel.rb
|
49
|
+
- lib/amazing_print/ext_loader.rb
|
49
50
|
- lib/amazing_print/formatter.rb
|
50
51
|
- lib/amazing_print/formatters.rb
|
51
52
|
- lib/amazing_print/formatters/array_formatter.rb
|
@@ -107,6 +108,8 @@ files:
|
|
107
108
|
- spec/support/active_record_data/6_0_multi.txt
|
108
109
|
- spec/support/active_record_data/6_1_diana.txt
|
109
110
|
- spec/support/active_record_data/6_1_multi.txt
|
111
|
+
- spec/support/active_record_data/7_0_diana.txt
|
112
|
+
- spec/support/active_record_data/7_0_multi.txt
|
110
113
|
- spec/support/ext_verifier.rb
|
111
114
|
- spec/support/mongoid_versions.rb
|
112
115
|
- spec/support/rails_versions.rb
|
@@ -129,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
132
|
- !ruby/object:Gem::Version
|
130
133
|
version: '0'
|
131
134
|
requirements: []
|
132
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.5.6
|
133
136
|
signing_key:
|
134
137
|
specification_version: 4
|
135
138
|
summary: Pretty print Ruby objects with proper indentation and colors
|