awesome_print 1.7.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/Appraisals +44 -34
- data/CHANGELOG.md +28 -0
- data/CONTRIBUTING.md +2 -1
- data/Gemfile.lock +25 -33
- data/LICENSE +16 -19
- data/README.md +88 -44
- data/Rakefile +5 -5
- data/awesome_print.gemspec +33 -0
- data/init.rb +1 -0
- data/lib/ap.rb +2 -2
- data/lib/awesome_print/colorize.rb +1 -1
- data/lib/awesome_print/core_ext/{array.rb → awesome_method_array.rb} +16 -18
- data/lib/awesome_print/core_ext/class.rb +3 -2
- data/lib/awesome_print/core_ext/kernel.rb +1 -1
- data/lib/awesome_print/core_ext/logger.rb +1 -1
- data/lib/awesome_print/core_ext/method.rb +2 -2
- data/lib/awesome_print/core_ext/object.rb +3 -2
- data/lib/awesome_print/core_ext/string.rb +3 -3
- data/lib/awesome_print/custom_defaults.rb +57 -0
- data/lib/awesome_print/ext/action_view.rb +8 -4
- data/lib/awesome_print/ext/active_record.rb +45 -12
- data/lib/awesome_print/ext/active_support.rb +1 -1
- data/lib/awesome_print/ext/mongo_mapper.rb +16 -13
- data/lib/awesome_print/ext/mongoid.rb +8 -6
- data/lib/awesome_print/ext/nobrainer.rb +8 -5
- data/lib/awesome_print/ext/nokogiri.rb +4 -4
- data/lib/awesome_print/ext/ostruct.rb +1 -1
- data/lib/awesome_print/ext/ripple.rb +5 -6
- data/lib/awesome_print/ext/sequel.rb +7 -6
- data/lib/awesome_print/formatter.rb +28 -28
- data/lib/awesome_print/formatters/array_formatter.rb +108 -42
- data/lib/awesome_print/formatters/base_formatter.rb +16 -14
- data/lib/awesome_print/formatters/class_formatter.rb +2 -1
- data/lib/awesome_print/formatters/dir_formatter.rb +1 -1
- data/lib/awesome_print/formatters/file_formatter.rb +1 -1
- data/lib/awesome_print/formatters/hash_formatter.rb +74 -22
- data/lib/awesome_print/formatters/object_formatter.rb +13 -15
- data/lib/awesome_print/formatters/struct_formatter.rb +71 -0
- data/lib/awesome_print/formatters.rb +15 -0
- data/lib/awesome_print/inspector.rb +83 -96
- data/lib/awesome_print/version.rb +2 -2
- data/lib/awesome_print.rb +18 -17
- data/spec/active_record_helper.rb +8 -2
- data/spec/colors_spec.rb +30 -30
- data/spec/core_ext/logger_spec.rb +43 -0
- data/spec/core_ext/string_spec.rb +20 -0
- data/spec/ext/action_view_spec.rb +21 -0
- data/spec/ext/active_record_spec.rb +260 -0
- data/spec/ext/active_support_spec.rb +30 -0
- data/spec/ext/mongo_mapper_spec.rb +261 -0
- data/spec/ext/mongoid_spec.rb +67 -0
- data/spec/ext/nobrainer_spec.rb +59 -0
- data/spec/ext/nokogiri_spec.rb +46 -0
- data/spec/ext/ostruct_spec.rb +22 -0
- data/spec/ext/ripple_spec.rb +48 -0
- data/spec/formats_spec.rb +193 -165
- data/spec/methods_spec.rb +125 -129
- data/spec/misc_spec.rb +95 -92
- data/spec/objects_spec.rb +119 -28
- data/spec/spec_helper.rb +29 -10
- data/spec/support/active_record_data/3_2_diana.txt +24 -0
- data/spec/support/active_record_data/3_2_diana_legacy.txt +24 -0
- data/spec/support/active_record_data/3_2_multi.txt +50 -0
- data/spec/support/active_record_data/3_2_multi_legacy.txt +50 -0
- data/spec/support/active_record_data/4_0_diana.txt +98 -0
- data/spec/support/active_record_data/4_0_multi.txt +198 -0
- data/spec/support/active_record_data/4_1_diana.txt +97 -0
- data/spec/support/active_record_data/4_1_multi.txt +196 -0
- data/spec/support/active_record_data/4_2_diana.txt +109 -0
- data/spec/support/active_record_data/4_2_diana_legacy.txt +109 -0
- data/spec/support/active_record_data/4_2_multi.txt +220 -0
- data/spec/support/active_record_data/4_2_multi_legacy.txt +220 -0
- data/spec/support/active_record_data/5_0_diana.txt +105 -0
- data/spec/support/active_record_data/5_0_multi.txt +212 -0
- data/spec/support/active_record_data/5_1_diana.txt +104 -0
- data/spec/support/active_record_data/5_1_multi.txt +210 -0
- data/spec/support/active_record_data/5_2_diana.txt +104 -0
- data/spec/support/active_record_data/5_2_multi.txt +210 -0
- data/spec/support/active_record_data/6_0_diana.txt +104 -0
- data/spec/support/active_record_data/6_0_multi.txt +210 -0
- data/spec/support/active_record_data/6_1_diana.txt +109 -0
- data/spec/support/active_record_data/6_1_multi.txt +220 -0
- data/spec/support/active_record_data.rb +20 -0
- data/spec/support/ext_verifier.rb +42 -0
- data/spec/support/mongoid_versions.rb +26 -0
- data/spec/support/rails_versions.rb +55 -0
- metadata +90 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bc6d20d854c529b902cfe961bd8271b30f1aa9f82c4db11bfdcaa6ecb6b1f469
|
4
|
+
data.tar.gz: c4f69e0cf2663cb4889b27414bd9f242789fea28790c3252dc5b2788da70bca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c34cd0b7347ecf6e98afc4ef0647f940a02a5d125c955748917c821e6bbf231830604fcbe0fb524c6bfdaa049d6f945bad658d30433bf878841b30a6d79ad765
|
7
|
+
data.tar.gz: 9cfae5c9646b5194a52c87b1ea38ba3d711cb616a713e66ce0ab83f255293a4b75f4016f349f047aa43d775d14b9f024fc0edccdf40b9f489e46626908162b00
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
@@ -1,52 +1,62 @@
|
|
1
|
-
appraise 'rails-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
# appraise 'rails-4.2' do
|
2
|
+
# gem 'rails', '~> 4.2.0'
|
3
|
+
#
|
4
|
+
# # The last version that doesn't need Ruby 2.0 and works with version 4.2 of
|
5
|
+
# # Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
|
6
|
+
# gem 'mime-types', '2.6.2', :platforms => :ruby_19
|
7
|
+
# end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
gem '
|
9
|
+
appraise 'rails-5.0' do
|
10
|
+
gem 'rails', '>= 5.0.0', '< 5.1'
|
11
|
+
gem 'sqlite3', '~> 1.3.6'
|
11
12
|
end
|
12
13
|
|
13
|
-
appraise 'rails-
|
14
|
-
gem 'rails', '
|
15
|
-
|
16
|
-
# The last version that doesn't need Ruby 2.0 and works with version 4.1 of
|
17
|
-
# Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
|
18
|
-
gem 'mime-types', '2.6.2', :platforms => :ruby_19
|
14
|
+
appraise 'rails-5.1' do
|
15
|
+
gem 'rails', '>= 5.1.0', '< 5.2'
|
19
16
|
end
|
20
17
|
|
21
|
-
appraise 'rails-
|
22
|
-
gem 'rails', '
|
23
|
-
|
24
|
-
# The last version that doesn't need Ruby 2.0 and works with version 4.2 of
|
25
|
-
# Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
|
26
|
-
gem 'mime-types', '2.6.2', :platforms => :ruby_19
|
18
|
+
appraise 'rails-5.2' do
|
19
|
+
gem 'rails', '>= 5.2.0', '< 5.3'
|
27
20
|
end
|
28
21
|
|
29
|
-
appraise '
|
30
|
-
gem '
|
22
|
+
appraise 'rails-6.0' do
|
23
|
+
gem 'rails', '>= 6.0.0', '< 6.1'
|
31
24
|
end
|
32
25
|
|
33
|
-
appraise '
|
34
|
-
gem '
|
26
|
+
appraise 'rails-6.1' do
|
27
|
+
gem 'rails', '>= 6.1.0', '< 6.2'
|
35
28
|
end
|
36
29
|
|
37
|
-
appraise 'mongoid-
|
38
|
-
gem 'mongoid', '~>
|
30
|
+
appraise 'mongoid-5.0' do
|
31
|
+
gem 'mongoid', '~> 5.0.0'
|
32
|
+
gem 'bigdecimal', '~> 1.3.5'
|
39
33
|
end
|
40
34
|
|
41
|
-
appraise '
|
42
|
-
gem '
|
35
|
+
appraise 'mongoid-6.0' do
|
36
|
+
gem 'mongoid', '~> 6.0.0'
|
43
37
|
end
|
44
38
|
|
45
|
-
appraise '
|
46
|
-
gem '
|
47
|
-
gem 'ripple'
|
39
|
+
appraise 'mongoid-7.0' do
|
40
|
+
gem 'mongoid', '~> 7.0.0'
|
48
41
|
end
|
49
42
|
|
50
|
-
appraise '
|
51
|
-
gem '
|
43
|
+
appraise 'mongoid-7.1' do
|
44
|
+
gem 'mongoid', '~> 7.1.0'
|
52
45
|
end
|
46
|
+
|
47
|
+
# appraise 'mongo_mapper' do
|
48
|
+
# gem 'mongo_mapper'
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# appraise 'ripple' do
|
52
|
+
# gem 'tzinfo'
|
53
|
+
# gem 'ripple'
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# appraise 'nobrainer' do
|
57
|
+
# gem 'nobrainer'
|
58
|
+
#
|
59
|
+
# # When activesupport 5 was released, it required ruby 2.2.2 as a minimum.
|
60
|
+
# # Locking this down to 4.2.6 allows our Ruby 1.9 tests to keep working.
|
61
|
+
# gem 'activesupport', '4.2.6', :platforms => :ruby_19
|
62
|
+
# end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,31 @@
|
|
1
1
|
## master (unreleased)
|
2
2
|
|
3
3
|
|
4
|
+
## 1.9.2
|
5
|
+
- Tests work with Ruby 2.6.6, 2.7.2 and 3.0.0
|
6
|
+
- Update awsome_print.gemspec nokogiri dependency to resolve CVEs [@gvwirth]
|
7
|
+
|
8
|
+
## 1.9.1
|
9
|
+
- Updated code so it can be released to rubygems.
|
10
|
+
- Updated nokogiri to resolve vulnerability scan
|
11
|
+
|
12
|
+
## 1.9.0
|
13
|
+
- Update method signature after change in IRB [@febeling]
|
14
|
+
- Fixes block and proc definition to work with Ruby 3.0.0 [@csalvato] - [#392]
|
15
|
+
- Removed check for Ruby 2.4 and earlier [@bryanh]
|
16
|
+
- Rails 5.0 builds are failing, because the sqlite3 version being installed is wrong version [#366]
|
17
|
+
- Fixes spec suite to properly work via travis, gets a clean build [@imajes, others]
|
18
|
+
- Adds support for ActiveModel::Errors [@dshinzie] - [#301]
|
19
|
+
- removes use of `strip_heredoc` from specs as it's a rails dep [@kstephens] - [#303]
|
20
|
+
- ArrayFormatter now returns arrays for has_many :through associations [@chadh13] - [#332]
|
21
|
+
|
22
|
+
## 1.8.0
|
23
|
+
- stat("$HOME/.aprc") once [@kstephens] - [#304]
|
24
|
+
- ActiveRecord: #joins now show the columns #select'ed [@adrianomitre] - [#211]
|
25
|
+
- Handles NoMethodError for IRB implicit `ai` [@jtnegrotto] - [#212]
|
26
|
+
- Replaced Fixnum reference with Integer
|
27
|
+
- Colorize ORM class names [@ixti]
|
28
|
+
|
4
29
|
## 1.7.0
|
5
30
|
- Refactoring by extracting formatters into their own classes [@waldyr] - [#237]
|
6
31
|
- Fixes Travis builds and improves tests [@nviennot], [@waldyr], [@gerrywastaken] - [#225], [#228], [#229], [#230], [#231]
|
@@ -129,6 +154,7 @@
|
|
129
154
|
- Initial Release.
|
130
155
|
|
131
156
|
[#200]: https://github.com/awesome-print/awesome_print/pull/200
|
157
|
+
[#212]: https://github.com/awesome-print/awesome_print/pull/212
|
132
158
|
[#216]: https://github.com/awesome-print/awesome_print/pull/216
|
133
159
|
[#217]: https://github.com/awesome-print/awesome_print/pull/217
|
134
160
|
[#222]: https://github.com/awesome-print/awesome_print/pull/222
|
@@ -145,6 +171,8 @@
|
|
145
171
|
[@clonezone]: https://github.com/clonezone
|
146
172
|
[@cyberdelia]: https://github.com/cyberdelia
|
147
173
|
[@gerrywastaken]: https://github.com/gerrywastaken
|
174
|
+
[@ixti]: https://github.com/ixti
|
175
|
+
[@jtnegrotto]: https://github.com/jtnegrotto
|
148
176
|
[@kemmason]: https://github.com/kemmason
|
149
177
|
[@maurogeorge]: https://github.com/maurogeorge
|
150
178
|
[@MaxPleaner]: https://github.com/MaxPleaner
|
data/CONTRIBUTING.md
CHANGED
@@ -6,7 +6,7 @@ We love pull requests. Here's a quick guide:
|
|
6
6
|
|
7
7
|
1. Create your feature branch (`git checkout -b my-new-feature`)
|
8
8
|
|
9
|
-
1. Update [CHANGELOG.md](https://github.com/
|
9
|
+
1. Update [CHANGELOG.md](https://github.com/awesome-print/awesome_print/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
|
10
10
|
|
11
11
|
1. Add/Update tests were appropriate
|
12
12
|
|
@@ -51,6 +51,7 @@ Special thanks goes to awesome team of contributors, namely:
|
|
51
51
|
* Barry Allard -- https://github.com/steakknife
|
52
52
|
* Benoit Daloze -- http://github.com/eregon
|
53
53
|
* Brandon Zylstra -- https://github.com/brandondrew
|
54
|
+
* Bryan Hanks, PMP -- https://github.com/bryanh
|
54
55
|
* Dan Lynn -- https://github.com/danlynn
|
55
56
|
* Daniel Johnson -- https://github.com/adhd360
|
56
57
|
* Daniel Bretoi -- http://github.com/danielb2
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
awesome_print (1.
|
4
|
+
awesome_print (1.9.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
appraisal (2.
|
9
|
+
appraisal (2.3.0)
|
10
10
|
bundler
|
11
11
|
rake
|
12
12
|
thor (>= 0.14.0)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
rspec-
|
25
|
-
|
26
|
-
rspec-
|
27
|
-
rspec-
|
28
|
-
rspec-support (~> 3.4.0)
|
29
|
-
rspec-expectations (3.4.0)
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
fakefs (1.3.2)
|
15
|
+
mini_portile2 (2.5.0)
|
16
|
+
nokogiri (1.11.1)
|
17
|
+
mini_portile2 (~> 2.5.0)
|
18
|
+
racc (~> 1.4)
|
19
|
+
racc (1.5.2)
|
20
|
+
rake (13.0.3)
|
21
|
+
rspec (3.10.0)
|
22
|
+
rspec-core (~> 3.10.0)
|
23
|
+
rspec-expectations (~> 3.10.0)
|
24
|
+
rspec-mocks (~> 3.10.0)
|
25
|
+
rspec-core (3.10.1)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-expectations (3.10.1)
|
30
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-mocks (3.10.1)
|
33
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-support (3.
|
36
|
-
|
37
|
-
|
38
|
-
json (~> 1.8)
|
39
|
-
simplecov-html (~> 0.10.0)
|
40
|
-
simplecov-html (0.10.0)
|
41
|
-
sqlite3 (1.3.11)
|
42
|
-
thor (0.19.1)
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-support (3.10.1)
|
34
|
+
sqlite3 (1.4.2)
|
35
|
+
thor (1.1.0)
|
43
36
|
|
44
37
|
PLATFORMS
|
45
38
|
ruby
|
@@ -47,11 +40,10 @@ PLATFORMS
|
|
47
40
|
DEPENDENCIES
|
48
41
|
appraisal
|
49
42
|
awesome_print!
|
50
|
-
codeclimate-test-reporter
|
51
43
|
fakefs (>= 0.2.1)
|
52
|
-
nokogiri (>= 1.
|
44
|
+
nokogiri (>= 1.11.0)
|
53
45
|
rspec (>= 3.0.0)
|
54
46
|
sqlite3
|
55
47
|
|
56
48
|
BUNDLED WITH
|
57
|
-
|
49
|
+
2.2.8
|
data/LICENSE
CHANGED
@@ -1,22 +1,19 @@
|
|
1
|
-
Copyright (c) 2010-
|
2
|
-
http://www.dvorkin.net
|
3
|
-
%w(mike dvorkin.net) * "@" || "twitter.com/mid"
|
1
|
+
Copyright (c) 2010-2019 Michael Dvorkin
|
4
2
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
12
9
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
15
12
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -5,23 +5,22 @@
|
|
5
5
|
[![Code Climate][code_climate_badge]][code_climate]
|
6
6
|
[![Code Climate Coverage][code_climate_coverage_badge]][code_climate]
|
7
7
|
[![RubyGems][gem_downloads_badge]][ruby_gems]
|
8
|
-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/
|
8
|
+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/awesome-print/awesome_print?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
9
9
|
|
10
10
|
|
11
11
|
Awesome Print is a Ruby library that pretty prints Ruby objects in full color
|
12
12
|
exposing their internal structure with proper indentation. Rails ActiveRecord
|
13
13
|
objects and usage within Rails templates are supported via included mixins.
|
14
14
|
|
15
|
-
__NOTE__: awesome_print v1.
|
16
|
-
|
17
|
-
v2.0 will *require* Ruby v1.9.3 or later and Rails v3.0 or later.
|
15
|
+
__NOTE__: awesome_print v1.9.0 may not work on Ruby versions 2.4 or older or Rails versions 4.2 or older.
|
16
|
+
The upcoming awesome_print v2.0 will *require* Ruby v1.9.3 or later and Rails v3.0 or later.
|
18
17
|
|
19
18
|
### Installation ###
|
20
19
|
# Installing as Ruby gem
|
21
20
|
$ gem install awesome_print
|
22
21
|
|
23
22
|
# Cloning the repository
|
24
|
-
$ git clone git://github.com/
|
23
|
+
$ git clone git://github.com/awesome-print/awesome_print.git
|
25
24
|
|
26
25
|
### Usage ###
|
27
26
|
|
@@ -33,34 +32,38 @@ ap object, options = {}
|
|
33
32
|
Default options:
|
34
33
|
|
35
34
|
```ruby
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
35
|
+
indent: 4, # Number of spaces for indenting.
|
36
|
+
index: true, # Display array indices.
|
37
|
+
html: false, # Use ANSI color codes rather than HTML.
|
38
|
+
multiline: true, # Display in multiple lines.
|
39
|
+
plain: false, # Use colors.
|
40
|
+
raw: false, # Do not recursively format instance variables.
|
41
|
+
sort_keys: false, # Do not sort hash keys.
|
42
|
+
sort_vars: true, # Sort instance variables.
|
43
|
+
limit: false, # Limit arrays & hashes. Accepts bool or int.
|
44
|
+
ruby19_syntax: false, # Use Ruby 1.9 hash syntax in output.
|
45
|
+
class_name: :class, # Method called to report the instance class name. (e.g. :to_s)
|
46
|
+
object_id: true, # Show object id.
|
47
|
+
color: {
|
48
|
+
args: :pale,
|
49
|
+
array: :white,
|
50
|
+
bigdecimal: :blue,
|
51
|
+
class: :yellow,
|
52
|
+
date: :greenish,
|
53
|
+
falseclass: :red,
|
54
|
+
integer: :blue,
|
55
|
+
float: :blue,
|
56
|
+
hash: :pale,
|
57
|
+
keyword: :cyan,
|
58
|
+
method: :purpleish,
|
59
|
+
nilclass: :red,
|
60
|
+
rational: :blue,
|
61
|
+
string: :yellowish,
|
62
|
+
struct: :pale,
|
63
|
+
symbol: :cyanish,
|
64
|
+
time: :greenish,
|
65
|
+
trueclass: :green,
|
66
|
+
variable: :cyanish
|
64
67
|
}
|
65
68
|
```
|
66
69
|
|
@@ -80,6 +83,8 @@ irb> "awesome print".ai
|
|
80
83
|
|
81
84
|
### Examples ###
|
82
85
|
|
86
|
+
#### Array
|
87
|
+
|
83
88
|
```ruby
|
84
89
|
$ cat > 1.rb
|
85
90
|
require "awesome_print"
|
@@ -100,7 +105,10 @@ $ ruby 1.rb
|
|
100
105
|
:distance => 4.2e+43
|
101
106
|
}
|
102
107
|
]
|
108
|
+
```
|
109
|
+
#### Hash
|
103
110
|
|
111
|
+
```ruby
|
104
112
|
$ cat > 2.rb
|
105
113
|
require "awesome_print"
|
106
114
|
data = { :now => Time.now, :class => Time.now.class, :distance => 42e42 }
|
@@ -112,7 +120,11 @@ $ ruby 2.rb
|
|
112
120
|
:now => Fri Apr 02 19:55:53 -0700 2010,
|
113
121
|
:distance => 4.2e+43
|
114
122
|
}
|
123
|
+
```
|
115
124
|
|
125
|
+
#### Nested array
|
126
|
+
|
127
|
+
```ruby
|
116
128
|
$ cat > 3.rb
|
117
129
|
require "awesome_print"
|
118
130
|
data = [ false, 42, %w(forty two) ]
|
@@ -122,6 +134,11 @@ ap data, :multiline => false
|
|
122
134
|
$ ruby 3.rb
|
123
135
|
[ false, 42, [ "forty", "two" ], [...] ]
|
124
136
|
|
137
|
+
```
|
138
|
+
|
139
|
+
#### Class methods
|
140
|
+
|
141
|
+
```ruby
|
125
142
|
$ cat > 4.rb
|
126
143
|
require "awesome_print"
|
127
144
|
class Hello
|
@@ -135,6 +152,11 @@ $ ruby 4.rb
|
|
135
152
|
[0] world(x, y, *z, &blk) Hello
|
136
153
|
]
|
137
154
|
|
155
|
+
```
|
156
|
+
|
157
|
+
#### Object methods
|
158
|
+
|
159
|
+
```ruby
|
138
160
|
$ cat > 5.rb
|
139
161
|
require "awesome_print"
|
140
162
|
ap (''.methods - Object.methods).grep(/!/)
|
@@ -163,6 +185,11 @@ $ ruby 5.rb
|
|
163
185
|
[19] upcase!() String
|
164
186
|
]
|
165
187
|
|
188
|
+
```
|
189
|
+
|
190
|
+
#### Compare output to value
|
191
|
+
|
192
|
+
```ruby
|
166
193
|
$ cat > 6.rb
|
167
194
|
require "awesome_print"
|
168
195
|
ap 42 == ap(42)
|
@@ -170,7 +197,13 @@ ap 42 == ap(42)
|
|
170
197
|
$ ruby 6.rb
|
171
198
|
42
|
172
199
|
true
|
173
|
-
|
200
|
+
|
201
|
+
```
|
202
|
+
|
203
|
+
#### Array with default output limit
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
$ cat > 7.rb
|
174
207
|
require "awesome_print"
|
175
208
|
some_array = (1..1000).to_a
|
176
209
|
ap some_array, :limit => true
|
@@ -185,8 +218,12 @@ $ ruby 7.rb
|
|
185
218
|
[998] 999,
|
186
219
|
[999] 1000
|
187
220
|
]
|
221
|
+
```
|
222
|
+
|
223
|
+
#### Array with specific output limit
|
188
224
|
|
189
|
-
|
225
|
+
```ruby
|
226
|
+
$ cat > 8.rb
|
190
227
|
require "awesome_print"
|
191
228
|
some_array = (1..1000).to_a
|
192
229
|
ap some_array, :limit => 5
|
@@ -201,7 +238,7 @@ $ ruby 8.rb
|
|
201
238
|
]
|
202
239
|
```
|
203
240
|
|
204
|
-
|
241
|
+
#### Rails console
|
205
242
|
```ruby
|
206
243
|
$ rails console
|
207
244
|
rails> require "awesome_print"
|
@@ -304,6 +341,14 @@ formatting:
|
|
304
341
|
|
305
342
|
<%= ap @accounts.first, :html => true %>
|
306
343
|
|
344
|
+
### String Convenience Methods ###
|
345
|
+
Use methods such as `.red` to set string color:
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
irb> puts "red text".red
|
349
|
+
red text # (it's red)
|
350
|
+
```
|
351
|
+
|
307
352
|
### Setting Custom Defaults ###
|
308
353
|
You can set your own default options by creating ``.aprc`` file in your home
|
309
354
|
directory. Within that file assign your defaults to ``AwesomePrint.defaults``.
|
@@ -325,11 +370,10 @@ AwesomePrint.defaults = {
|
|
325
370
|
AwesomePrint follows the [Semantic Versioning](http://semver.org/) standard.
|
326
371
|
|
327
372
|
### Contributing ###
|
328
|
-
See [
|
329
|
-
for information.
|
373
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
|
330
374
|
|
331
375
|
### License ###
|
332
|
-
Copyright (c) 2010-
|
376
|
+
Copyright (c) 2010-2016 Michael Dvorkin and contributors
|
333
377
|
|
334
378
|
http://www.dvorkin.net
|
335
379
|
|
@@ -340,8 +384,8 @@ Released under the MIT license. See LICENSE file for details.
|
|
340
384
|
[gem_version_badge]: https://img.shields.io/gem/v/awesome_print.svg?style=flat
|
341
385
|
[gem_downloads_badge]: http://img.shields.io/gem/dt/awesome_print.svg?style=flat
|
342
386
|
[ruby_gems]: http://rubygems.org/gems/awesome_print
|
343
|
-
[travis_ci]: http://travis-ci.org/
|
344
|
-
[travis_ci_badge]: https://img.shields.io/travis/
|
345
|
-
[code_climate]: https://codeclimate.com/github/
|
346
|
-
[code_climate_badge]: http://img.shields.io/codeclimate/github/
|
347
|
-
[code_climate_coverage_badge]: https://codeclimate.com/github/
|
387
|
+
[travis_ci]: http://travis-ci.org/awesome-print/awesome_print
|
388
|
+
[travis_ci_badge]: https://img.shields.io/travis/awesome-print/awesome_print/master.svg?style=flat
|
389
|
+
[code_climate]: https://codeclimate.com/github/awesome-print/awesome_print
|
390
|
+
[code_climate_badge]: http://img.shields.io/codeclimate/github/awesome-print/awesome_print.svg?style=flat
|
391
|
+
[code_climate_coverage_badge]: https://codeclimate.com/github/awesome-print/awesome_print/badges/coverage.svg
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'bundler'
|
5
5
|
Bundler::GemHelper.install_tasks
|
6
6
|
|
7
7
|
task :default do
|
@@ -16,9 +16,9 @@ task :appraise do
|
|
16
16
|
exec 'appraisal install && appraisal rake'
|
17
17
|
end
|
18
18
|
|
19
|
-
desc
|
19
|
+
desc 'Run all awesome_print gem specs'
|
20
20
|
task :spec do
|
21
21
|
# Run plain rspec command without RSpec::Core::RakeTask overrides.
|
22
|
-
exec
|
22
|
+
exec 'rspec -c spec'
|
23
23
|
end
|
24
24
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2010-2016 Michael Dvorkin and contributors
|
2
|
+
#
|
3
|
+
# Awesome Print 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
|
+
$:.push File.expand_path('../lib', __FILE__)
|
8
|
+
require 'awesome_print/version'
|
9
|
+
|
10
|
+
Gem::Specification.new do |s|
|
11
|
+
s.name = 'awesome_print'
|
12
|
+
s.version = AwesomePrint.version
|
13
|
+
s.authors = 'Michael Dvorkin'
|
14
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
15
|
+
s.email = 'mike@dvorkin.net'
|
16
|
+
s.homepage = 'https://github.com/awesome-print/awesome_print'
|
17
|
+
s.summary = 'Pretty print Ruby objects with proper indentation and colors'
|
18
|
+
s.description = 'Great Ruby debugging companion: pretty print Ruby objects to visualize their structure. Supports custom object formatting via plugins'
|
19
|
+
s.license = 'MIT'
|
20
|
+
|
21
|
+
s.files = Dir['[A-Z]*[^~]'] + Dir['lib/**/*.rb'] + Dir['spec/**/*'] + ['.gitignore']
|
22
|
+
s.test_files = Dir['spec/**/*']
|
23
|
+
s.executables = []
|
24
|
+
s.require_paths = ['lib']
|
25
|
+
|
26
|
+
s.add_development_dependency 'rspec', '>= 3.0.0'
|
27
|
+
s.add_development_dependency 'appraisal'
|
28
|
+
s.add_development_dependency 'fakefs', '>= 0.2.1'
|
29
|
+
s.add_development_dependency 'sqlite3'
|
30
|
+
s.add_development_dependency 'nokogiri', '>= 1.11.0'
|
31
|
+
# s.add_development_dependency 'simplecov'
|
32
|
+
# s.add_development_dependency 'codeclimate-test-reporter'
|
33
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'lib', 'awesome_print')
|
data/lib/ap.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Michael Dvorkin and contributors
|
2
2
|
#
|
3
3
|
# Awesome Print is freely distributable under the terms of MIT license.
|
4
4
|
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
@@ -7,4 +7,4 @@
|
|
7
7
|
# Keeping this for backwards compatibility to allow
|
8
8
|
# require "ap"
|
9
9
|
#
|
10
|
-
require File.dirname(__FILE__) +
|
10
|
+
require File.dirname(__FILE__) + '/awesome_print'
|