awesome_print 1.2.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -2
- data/Appraisals +62 -0
- data/CHANGELOG.md +180 -0
- data/CONTRIBUTING.md +82 -0
- data/Gemfile +3 -2
- data/LICENSE +16 -19
- data/README.md +112 -87
- data/Rakefile +17 -4
- data/awesome_print.gemspec +33 -0
- data/init.rb +1 -0
- data/lib/ap.rb +2 -2
- data/lib/awesome_print.rb +22 -16
- data/lib/awesome_print/colorize.rb +24 -0
- 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 +47 -13
- 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 +9 -7
- data/lib/awesome_print/ext/nobrainer.rb +52 -0
- data/lib/awesome_print/ext/nokogiri.rb +4 -4
- data/lib/awesome_print/ext/ostruct.rb +27 -0
- data/lib/awesome_print/ext/ripple.rb +6 -7
- data/lib/awesome_print/ext/sequel.rb +7 -6
- data/lib/awesome_print/formatter.rb +54 -327
- data/lib/awesome_print/formatters.rb +15 -0
- data/lib/awesome_print/formatters/array_formatter.rb +139 -0
- data/lib/awesome_print/formatters/base_formatter.rb +140 -0
- data/lib/awesome_print/formatters/class_formatter.rb +25 -0
- data/lib/awesome_print/formatters/dir_formatter.rb +22 -0
- data/lib/awesome_print/formatters/file_formatter.rb +22 -0
- data/lib/awesome_print/formatters/hash_formatter.rb +106 -0
- data/lib/awesome_print/formatters/method_formatter.rb +22 -0
- data/lib/awesome_print/formatters/object_formatter.rb +78 -0
- data/lib/awesome_print/formatters/simple_formatter.rb +21 -0
- data/lib/awesome_print/formatters/struct_formatter.rb +71 -0
- data/lib/awesome_print/indentator.rb +18 -0
- data/lib/awesome_print/inspector.rb +92 -94
- data/lib/awesome_print/version.rb +2 -2
- data/spec/active_record_helper.rb +30 -0
- data/spec/colors_spec.rb +31 -31
- 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 +272 -205
- data/spec/methods_spec.rb +173 -177
- data/spec/misc_spec.rb +129 -105
- data/spec/objects_spec.rb +162 -27
- data/spec/spec_helper.rb +75 -37
- data/spec/support/active_record_data.rb +20 -0
- 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/ext_verifier.rb +42 -0
- data/spec/support/mongoid_versions.rb +26 -0
- data/spec/support/rails_versions.rb +55 -0
- metadata +163 -32
- data/CHANGELOG +0 -96
- data/lib/awesome_print/ext/no_brainer.rb +0 -58
metadata
CHANGED
@@ -1,117 +1,248 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2
|
5
|
-
prerelease:
|
4
|
+
version: 1.9.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Dvorkin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-03-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 3.0.0
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: fakefs
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- -
|
45
|
+
- - ">="
|
36
46
|
- !ruby/object:Gem::Version
|
37
47
|
version: 0.2.1
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- -
|
52
|
+
- - ">="
|
44
53
|
- !ruby/object:Gem::Version
|
45
54
|
version: 0.2.1
|
46
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.11.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.11.0
|
83
|
+
description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
|
47
84
|
their structure. Supports custom object formatting via plugins'
|
48
85
|
email: mike@dvorkin.net
|
49
86
|
executables: []
|
50
87
|
extensions: []
|
51
88
|
extra_rdoc_files: []
|
52
89
|
files:
|
53
|
-
-
|
90
|
+
- ".gitignore"
|
91
|
+
- Appraisals
|
92
|
+
- CHANGELOG.md
|
93
|
+
- CONTRIBUTING.md
|
54
94
|
- Gemfile
|
55
95
|
- Gemfile.lock
|
56
96
|
- LICENSE
|
57
|
-
- Rakefile
|
58
97
|
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- awesome_print.gemspec
|
100
|
+
- init.rb
|
59
101
|
- lib/ap.rb
|
60
|
-
- lib/awesome_print
|
102
|
+
- lib/awesome_print.rb
|
103
|
+
- lib/awesome_print/colorize.rb
|
104
|
+
- lib/awesome_print/core_ext/awesome_method_array.rb
|
61
105
|
- lib/awesome_print/core_ext/class.rb
|
62
106
|
- lib/awesome_print/core_ext/kernel.rb
|
63
107
|
- lib/awesome_print/core_ext/logger.rb
|
64
108
|
- lib/awesome_print/core_ext/method.rb
|
65
109
|
- lib/awesome_print/core_ext/object.rb
|
66
110
|
- lib/awesome_print/core_ext/string.rb
|
111
|
+
- lib/awesome_print/custom_defaults.rb
|
67
112
|
- lib/awesome_print/ext/action_view.rb
|
68
113
|
- lib/awesome_print/ext/active_record.rb
|
69
114
|
- lib/awesome_print/ext/active_support.rb
|
70
115
|
- lib/awesome_print/ext/mongo_mapper.rb
|
71
116
|
- lib/awesome_print/ext/mongoid.rb
|
72
|
-
- lib/awesome_print/ext/
|
117
|
+
- lib/awesome_print/ext/nobrainer.rb
|
73
118
|
- lib/awesome_print/ext/nokogiri.rb
|
119
|
+
- lib/awesome_print/ext/ostruct.rb
|
74
120
|
- lib/awesome_print/ext/ripple.rb
|
75
121
|
- lib/awesome_print/ext/sequel.rb
|
76
122
|
- lib/awesome_print/formatter.rb
|
123
|
+
- lib/awesome_print/formatters.rb
|
124
|
+
- lib/awesome_print/formatters/array_formatter.rb
|
125
|
+
- lib/awesome_print/formatters/base_formatter.rb
|
126
|
+
- lib/awesome_print/formatters/class_formatter.rb
|
127
|
+
- lib/awesome_print/formatters/dir_formatter.rb
|
128
|
+
- lib/awesome_print/formatters/file_formatter.rb
|
129
|
+
- lib/awesome_print/formatters/hash_formatter.rb
|
130
|
+
- lib/awesome_print/formatters/method_formatter.rb
|
131
|
+
- lib/awesome_print/formatters/object_formatter.rb
|
132
|
+
- lib/awesome_print/formatters/simple_formatter.rb
|
133
|
+
- lib/awesome_print/formatters/struct_formatter.rb
|
134
|
+
- lib/awesome_print/indentator.rb
|
77
135
|
- lib/awesome_print/inspector.rb
|
78
136
|
- lib/awesome_print/version.rb
|
79
|
-
-
|
137
|
+
- spec/active_record_helper.rb
|
80
138
|
- spec/colors_spec.rb
|
139
|
+
- spec/core_ext/logger_spec.rb
|
140
|
+
- spec/core_ext/string_spec.rb
|
141
|
+
- spec/ext/action_view_spec.rb
|
142
|
+
- spec/ext/active_record_spec.rb
|
143
|
+
- spec/ext/active_support_spec.rb
|
144
|
+
- spec/ext/mongo_mapper_spec.rb
|
145
|
+
- spec/ext/mongoid_spec.rb
|
146
|
+
- spec/ext/nobrainer_spec.rb
|
147
|
+
- spec/ext/nokogiri_spec.rb
|
148
|
+
- spec/ext/ostruct_spec.rb
|
149
|
+
- spec/ext/ripple_spec.rb
|
81
150
|
- spec/formats_spec.rb
|
82
151
|
- spec/methods_spec.rb
|
83
152
|
- spec/misc_spec.rb
|
84
153
|
- spec/objects_spec.rb
|
85
154
|
- spec/spec_helper.rb
|
86
|
-
- .
|
87
|
-
|
88
|
-
|
155
|
+
- spec/support/active_record_data.rb
|
156
|
+
- spec/support/active_record_data/3_2_diana.txt
|
157
|
+
- spec/support/active_record_data/3_2_diana_legacy.txt
|
158
|
+
- spec/support/active_record_data/3_2_multi.txt
|
159
|
+
- spec/support/active_record_data/3_2_multi_legacy.txt
|
160
|
+
- spec/support/active_record_data/4_0_diana.txt
|
161
|
+
- spec/support/active_record_data/4_0_multi.txt
|
162
|
+
- spec/support/active_record_data/4_1_diana.txt
|
163
|
+
- spec/support/active_record_data/4_1_multi.txt
|
164
|
+
- spec/support/active_record_data/4_2_diana.txt
|
165
|
+
- spec/support/active_record_data/4_2_diana_legacy.txt
|
166
|
+
- spec/support/active_record_data/4_2_multi.txt
|
167
|
+
- spec/support/active_record_data/4_2_multi_legacy.txt
|
168
|
+
- spec/support/active_record_data/5_0_diana.txt
|
169
|
+
- spec/support/active_record_data/5_0_multi.txt
|
170
|
+
- spec/support/active_record_data/5_1_diana.txt
|
171
|
+
- spec/support/active_record_data/5_1_multi.txt
|
172
|
+
- spec/support/active_record_data/5_2_diana.txt
|
173
|
+
- spec/support/active_record_data/5_2_multi.txt
|
174
|
+
- spec/support/active_record_data/6_0_diana.txt
|
175
|
+
- spec/support/active_record_data/6_0_multi.txt
|
176
|
+
- spec/support/active_record_data/6_1_diana.txt
|
177
|
+
- spec/support/active_record_data/6_1_multi.txt
|
178
|
+
- spec/support/ext_verifier.rb
|
179
|
+
- spec/support/mongoid_versions.rb
|
180
|
+
- spec/support/rails_versions.rb
|
181
|
+
homepage: https://github.com/awesome-print/awesome_print
|
182
|
+
licenses:
|
183
|
+
- MIT
|
184
|
+
metadata: {}
|
89
185
|
post_install_message:
|
90
186
|
rdoc_options: []
|
91
187
|
require_paths:
|
92
188
|
- lib
|
93
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
190
|
requirements:
|
96
|
-
- -
|
191
|
+
- - ">="
|
97
192
|
- !ruby/object:Gem::Version
|
98
193
|
version: '0'
|
99
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
195
|
requirements:
|
102
|
-
- -
|
196
|
+
- - ">="
|
103
197
|
- !ruby/object:Gem::Version
|
104
198
|
version: '0'
|
105
199
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 1.8.24
|
200
|
+
rubygems_version: 3.1.4
|
108
201
|
signing_key:
|
109
|
-
specification_version:
|
202
|
+
specification_version: 4
|
110
203
|
summary: Pretty print Ruby objects with proper indentation and colors
|
111
204
|
test_files:
|
205
|
+
- spec/spec_helper.rb
|
206
|
+
- spec/core_ext/logger_spec.rb
|
207
|
+
- spec/core_ext/string_spec.rb
|
112
208
|
- spec/colors_spec.rb
|
113
|
-
- spec/
|
209
|
+
- spec/ext/active_support_spec.rb
|
210
|
+
- spec/ext/mongoid_spec.rb
|
211
|
+
- spec/ext/active_record_spec.rb
|
212
|
+
- spec/ext/ripple_spec.rb
|
213
|
+
- spec/ext/nokogiri_spec.rb
|
214
|
+
- spec/ext/nobrainer_spec.rb
|
215
|
+
- spec/ext/mongo_mapper_spec.rb
|
216
|
+
- spec/ext/ostruct_spec.rb
|
217
|
+
- spec/ext/action_view_spec.rb
|
114
218
|
- spec/methods_spec.rb
|
115
|
-
- spec/
|
219
|
+
- spec/active_record_helper.rb
|
116
220
|
- spec/objects_spec.rb
|
117
|
-
- spec/
|
221
|
+
- spec/support/mongoid_versions.rb
|
222
|
+
- spec/support/active_record_data/4_2_multi.txt
|
223
|
+
- spec/support/active_record_data/6_1_multi.txt
|
224
|
+
- spec/support/active_record_data/3_2_diana.txt
|
225
|
+
- spec/support/active_record_data/4_1_diana.txt
|
226
|
+
- spec/support/active_record_data/5_0_multi.txt
|
227
|
+
- spec/support/active_record_data/5_2_diana.txt
|
228
|
+
- spec/support/active_record_data/4_2_diana_legacy.txt
|
229
|
+
- spec/support/active_record_data/4_2_multi_legacy.txt
|
230
|
+
- spec/support/active_record_data/6_0_multi.txt
|
231
|
+
- spec/support/active_record_data/4_0_diana.txt
|
232
|
+
- spec/support/active_record_data/5_1_multi.txt
|
233
|
+
- spec/support/active_record_data/4_0_multi.txt
|
234
|
+
- spec/support/active_record_data/5_1_diana.txt
|
235
|
+
- spec/support/active_record_data/6_0_diana.txt
|
236
|
+
- spec/support/active_record_data/5_2_multi.txt
|
237
|
+
- spec/support/active_record_data/4_1_multi.txt
|
238
|
+
- spec/support/active_record_data/5_0_diana.txt
|
239
|
+
- spec/support/active_record_data/3_2_diana_legacy.txt
|
240
|
+
- spec/support/active_record_data/3_2_multi_legacy.txt
|
241
|
+
- spec/support/active_record_data/3_2_multi.txt
|
242
|
+
- spec/support/active_record_data/6_1_diana.txt
|
243
|
+
- spec/support/active_record_data/4_2_diana.txt
|
244
|
+
- spec/support/ext_verifier.rb
|
245
|
+
- spec/support/rails_versions.rb
|
246
|
+
- spec/support/active_record_data.rb
|
247
|
+
- spec/formats_spec.rb
|
248
|
+
- spec/misc_spec.rb
|
data/CHANGELOG
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
1.2.0 <-- NOTE: This is the *last* release supporting Ruby < v1.9.3 and Rails < v3.
|
2
|
-
- Added Sequel ORM plugin (Jonathan Davies)
|
3
|
-
- Added Ripple plugin (Ruby modeling layer for Riak, Scott Hyndman)
|
4
|
-
- Added NoBrainer plugin (Ruby ORM for RethinkDB, Nicolas Viennot)
|
5
|
-
- Added formatting for Ruby set objects (Richard Hall)
|
6
|
-
- Fixed HTML formatting (Mike McQuaid)
|
7
|
-
- Other minor bugs and enhancements
|
8
|
-
|
9
|
-
1.1.0
|
10
|
-
- Objects are no longer recursively formatted by default. Reenable by using :raw => true option.
|
11
|
-
- ap(object) now returns nil when running under IRB or Pry
|
12
|
-
- Added support for Mongoid 3 and Moped (Nikolaj Nikolajsen)
|
13
|
-
- Improved formatting of MongoMapper objects (George .)
|
14
|
-
- ActiveRecord::Relation now renders as array (Dan Lynn)
|
15
|
-
- Formatting BigDecimal no longer looses precision (Evan Senter)
|
16
|
-
- Added AwesomePrint.irb! and AwesomePrint.pry! convenience methods
|
17
|
-
- Fixed conflict with the colorize gem
|
18
|
-
- Misc tweaks and bug fixes
|
19
|
-
|
20
|
-
1.0.2
|
21
|
-
- Added formatting of Mongoid documents (Adam Doppelt)
|
22
|
-
- ActiveRecord objects display attributes only. Use :raw => true to display the entire object
|
23
|
-
- ActiveSupport::Date objects get formatted as regular Date
|
24
|
-
- Rails.logger.ap colorizes output based on ActiveSupport::LogSubscriber.colorize_logging (default is true)
|
25
|
-
- Improved formatting of methods array
|
26
|
-
|
27
|
-
1.0.1
|
28
|
-
- Updated repo tags for Rubygems.org
|
29
|
-
|
30
|
-
1.0.0 Thanksgiving edition
|
31
|
-
- Added ability to format *arbitrary* Ruby object
|
32
|
-
- Added :limit option to limit large output for arrays and hashes (Andrew Horsman)
|
33
|
-
- Improved HTML formatting when :html => true (Daniel Johnson)
|
34
|
-
- Added Mongoid extension (Adam Doppelt)
|
35
|
-
- Added Nokogiri extension (Adam Doppelt)
|
36
|
-
- Removed Jeweler gem dependency
|
37
|
-
|
38
|
-
0.4.0
|
39
|
-
- 'ap object' now returns the object (Stephan Hagemann)
|
40
|
-
- Added :html => true option to enable HTML colors rather that ANSI (ex. Sinatra templates)
|
41
|
-
- Added AwesomePrint.force_colors! to allow color output on demand (Andrew O'Brien)
|
42
|
-
- Added MongoMapper formatter mixin (Elpizo Choi)
|
43
|
-
- Fixed formatting of methods array when object#method is overridden
|
44
|
-
- Fixed potential stack errors by checking whether AwesomePrint is already loaded
|
45
|
-
- Improved Ruby 1.8.6 and 1.8.7 compatibility
|
46
|
-
- Improved Windows compatibility (Viktar Basharymau)
|
47
|
-
|
48
|
-
0.3.2
|
49
|
-
- Make sure Rails mixins get loaded in Rails console when required from .irbrc
|
50
|
-
- Fixed an issue with classes that define their own #send method (ex: Socket)
|
51
|
-
- Fixed compatibility issue with Liquid gem that defines Module#liquid_methods
|
52
|
-
- Fixed hash spec for Ruby < 1.9 where order of hash keys is not guaranteed
|
53
|
-
- Added :sorted_hash_keys option to sort hash keys (Ed Ruder)
|
54
|
-
|
55
|
-
0.3.1 RubyConf X edition
|
56
|
-
- Fixed Ruby 1.8.6 compatibility issues (thanks, Tim!)
|
57
|
-
- Fixed stack overflow issue with Rails 2.3.x console
|
58
|
-
|
59
|
-
0.3.0
|
60
|
-
- Display object.methods and family in human readable format
|
61
|
-
- Objects inherited from Array, Hash, File, Dir, and Struct are shown as their base class
|
62
|
-
- Added option to suppress array index in output (Sean Gallagher)
|
63
|
-
- Updated README on how to set up ~/.irbrc for MacRuby (Eloy Duran)
|
64
|
-
- Specs pass 100% with Ruby 1.8.7/RSpec 1.3 and Ruby 1.9.2/RSpec 2.0
|
65
|
-
|
66
|
-
0.2.1
|
67
|
-
- ap can now be used within Rails templates (ex. <%= ap object %>)
|
68
|
-
- Added support for printing Struct
|
69
|
-
|
70
|
-
0.2.0
|
71
|
-
- Added support for logger.ap (including Rails logger)
|
72
|
-
- Added support for HashWithIndifferentAccess from ActiveSupport
|
73
|
-
- ap now works with scripts that use ActiveRecord/ActiveSupport outside Rails
|
74
|
-
- ap now correctly shows file and directory names with fancy characters (shell escape)
|
75
|
-
|
76
|
-
0.1.4
|
77
|
-
- Format BigDecimal and Rational objects as Float scalars
|
78
|
-
- Explicit options parameter can override custom defaults
|
79
|
-
- Custom defaults are not interfering when running specs
|
80
|
-
- Custom defaults now work correctly with Ruby 1.9.x
|
81
|
-
|
82
|
-
0.1.3
|
83
|
-
- Added support for setting custom defaults in ~/.aprc
|
84
|
-
|
85
|
-
0.1.2
|
86
|
-
- Correctly handle empty arrays and hashes
|
87
|
-
- Use alias_method instead of alias (fixes non-tty method aliasing)
|
88
|
-
- Added awesome_inspect method
|
89
|
-
|
90
|
-
0.1.1
|
91
|
-
- Added support for tableless ActiveRecord models
|
92
|
-
- Left align hash keys if @options[:indent] is negative
|
93
|
-
|
94
|
-
0.1.0
|
95
|
-
- Initial Release.
|
96
|
-
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# Copyright (c) 2010-2013 Michael Dvorkin
|
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
|
-
module AwesomePrint
|
7
|
-
module NoBrainer
|
8
|
-
|
9
|
-
def self.included(base)
|
10
|
-
base.send :alias_method, :cast_without_no_brainer, :cast
|
11
|
-
base.send :alias_method, :cast, :cast_with_no_brainer
|
12
|
-
end
|
13
|
-
|
14
|
-
# Add NoBrainer class names to the dispatcher pipeline.
|
15
|
-
#------------------------------------------------------------------------------
|
16
|
-
def cast_with_no_brainer(object, type)
|
17
|
-
cast = cast_without_no_brainer(object, type)
|
18
|
-
if defined?(::NoBrainer::Document)
|
19
|
-
if object.is_a?(Class) && object.ancestors.include?(::NoBrainer::Document)
|
20
|
-
cast = :no_brainer_class
|
21
|
-
elsif object.class.ancestors.include?(::NoBrainer::Document)
|
22
|
-
cast = :no_brainer_document
|
23
|
-
end
|
24
|
-
end
|
25
|
-
cast
|
26
|
-
end
|
27
|
-
|
28
|
-
# Format NoBrainer class object.
|
29
|
-
#------------------------------------------------------------------------------
|
30
|
-
def awesome_no_brainer_class(object)
|
31
|
-
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:fields)
|
32
|
-
|
33
|
-
# We want id first
|
34
|
-
data = object.fields.sort_by { |key| key[0] == :id ? '_id' : key[0].to_s }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
|
35
|
-
hash[c[0]] = :object
|
36
|
-
hash
|
37
|
-
end
|
38
|
-
"class #{object} < #{object.superclass} " << awesome_hash(data)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Format NoBrainer Document object.
|
42
|
-
#------------------------------------------------------------------------------
|
43
|
-
def awesome_no_brainer_document(object)
|
44
|
-
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
|
45
|
-
|
46
|
-
data = object.attributes.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
|
47
|
-
hash[c[0].to_sym] = c[1]
|
48
|
-
hash
|
49
|
-
end
|
50
|
-
if !object.errors.empty?
|
51
|
-
data = {:errors => object.errors, :attributes => data}
|
52
|
-
end
|
53
|
-
"#{object} #{awesome_hash(data)}"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
AwesomePrint::Formatter.send(:include, AwesomePrint::NoBrainer)
|