awesome_print 1.8.0 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Appraisals +16 -48
  4. data/CHANGELOG.md +10 -1
  5. data/LICENSE +16 -19
  6. data/README.md +3 -10
  7. data/lib/ap.rb +1 -5
  8. data/lib/awesome_print.rb +7 -29
  9. data/lib/awesome_print/colorize.rb +2 -0
  10. data/lib/awesome_print/core_ext/active_support.rb +7 -0
  11. data/lib/awesome_print/core_ext/awesome_method_array.rb +0 -6
  12. data/lib/awesome_print/core_ext/class.rb +0 -5
  13. data/lib/awesome_print/core_ext/kernel.rb +0 -5
  14. data/lib/awesome_print/core_ext/logger.rb +0 -5
  15. data/lib/awesome_print/core_ext/object.rb +0 -5
  16. data/lib/awesome_print/core_ext/string.rb +0 -5
  17. data/lib/awesome_print/formatter.rb +38 -98
  18. data/lib/awesome_print/formatters/array_formatter.rb +10 -7
  19. data/lib/awesome_print/formatters/base_formatter.rb +17 -50
  20. data/lib/awesome_print/formatters/bigdecimal_formatter.rb +20 -0
  21. data/lib/awesome_print/formatters/class_formatter.rb +5 -6
  22. data/lib/awesome_print/formatters/dir_formatter.rb +4 -6
  23. data/lib/awesome_print/formatters/ext/active_model_error_formatter.rb +44 -0
  24. data/lib/awesome_print/formatters/ext/active_record_attributeset_formatter.rb +27 -0
  25. data/lib/awesome_print/formatters/ext/active_record_class_formatter.rb +43 -0
  26. data/lib/awesome_print/formatters/ext/active_record_instance_formatter.rb +48 -0
  27. data/lib/awesome_print/formatters/ext/active_record_relation_formatter.rb +19 -0
  28. data/lib/awesome_print/formatters/ext/bson_objectid_formatter.rb +20 -0
  29. data/lib/awesome_print/formatters/ext/hash_with_indifferent_access_formatter.rb +20 -0
  30. data/lib/awesome_print/formatters/ext/mongoid_document_formatter.rb +59 -0
  31. data/lib/awesome_print/formatters/ext/nokogiri_document_formatter.rb +30 -0
  32. data/lib/awesome_print/formatters/ext/nokogiri_node_formatter.rb +29 -0
  33. data/lib/awesome_print/formatters/ext/nokogiri_nodeset_formatter.rb +32 -0
  34. data/lib/awesome_print/formatters/ext/sequel_dataset_formatter.rb +20 -0
  35. data/lib/awesome_print/formatters/ext/sequel_model_class_formatter.rb +25 -0
  36. data/lib/awesome_print/formatters/ext/sequel_model_formatter.rb +26 -0
  37. data/lib/awesome_print/formatters/ext/time_with_zone_formatter.rb +24 -0
  38. data/lib/awesome_print/formatters/fallback_formatter.rb +55 -0
  39. data/lib/awesome_print/formatters/false_class_formatter.rb +15 -0
  40. data/lib/awesome_print/formatters/file_formatter.rb +4 -6
  41. data/lib/awesome_print/formatters/hash_formatter.rb +12 -7
  42. data/lib/awesome_print/formatters/integer_formatter.rb +11 -0
  43. data/lib/awesome_print/formatters/method_formatter.rb +8 -6
  44. data/lib/awesome_print/formatters/module_formatter.rb +18 -0
  45. data/lib/awesome_print/formatters/nil_class_formatter.rb +19 -0
  46. data/lib/awesome_print/formatters/object_formatter.rb +20 -7
  47. data/lib/awesome_print/formatters/open_struct.rb +19 -0
  48. data/lib/awesome_print/formatters/range_formatter.rb +11 -0
  49. data/lib/awesome_print/formatters/rational_formatter.rb +15 -0
  50. data/lib/awesome_print/formatters/set_formatter.rb +19 -0
  51. data/lib/awesome_print/formatters/simple_formatter.rb +10 -8
  52. data/lib/awesome_print/formatters/string_formatter.rb +14 -0
  53. data/lib/awesome_print/formatters/struct_formatter.rb +8 -6
  54. data/lib/awesome_print/formatters/symbol_formatter.rb +18 -0
  55. data/lib/awesome_print/formatters/true_class_formatter.rb +15 -0
  56. data/lib/awesome_print/formatters/unbound_method_formatter.rb +15 -0
  57. data/lib/awesome_print/inspector.rb +20 -16
  58. data/lib/awesome_print/limiter.rb +63 -0
  59. data/lib/awesome_print/registrar.rb +20 -0
  60. data/lib/awesome_print/version.rb +6 -6
  61. data/spec/formatters/array_spec.rb +251 -0
  62. data/spec/formatters/big_decimal_spec.rb +28 -0
  63. data/spec/formatters/class_spec.rb +91 -0
  64. data/spec/formatters/dir_file_spec.rb +43 -0
  65. data/spec/{ext → formatters/ext}/active_record_spec.rb +27 -63
  66. data/spec/{ext → formatters/ext}/active_support_spec.rb +6 -6
  67. data/spec/{ext → formatters/ext}/mongoid_spec.rb +4 -41
  68. data/spec/{ext → formatters/ext}/nokogiri_spec.rb +0 -0
  69. data/spec/formatters/hash_spec.rb +284 -0
  70. data/spec/{methods_spec.rb → formatters/methods_spec.rb} +13 -7
  71. data/spec/{objects_spec.rb → formatters/objects_spec.rb} +49 -0
  72. data/spec/{ext → formatters}/ostruct_spec.rb +1 -0
  73. data/spec/formatters/set_spec.rb +49 -0
  74. data/spec/formatters/struct_spec.rb +61 -0
  75. data/spec/merge_options_spec.rb +13 -0
  76. data/spec/misc_spec.rb +21 -21
  77. data/spec/spec_helper.rb +5 -10
  78. data/spec/support/active_record_data/5_1_diana.txt +104 -0
  79. data/spec/support/active_record_data/5_1_multi.txt +210 -0
  80. data/spec/support/active_record_data/5_2_diana.txt +104 -0
  81. data/spec/support/active_record_data/5_2_multi.txt +210 -0
  82. data/spec/support/ext_verifier.rb +0 -15
  83. data/spec/support/mongoid_versions.rb +4 -4
  84. data/spec/support/rails_versions.rb +10 -20
  85. metadata +98 -87
  86. data/lib/awesome_print/core_ext/method.rb +0 -21
  87. data/lib/awesome_print/ext/action_view.rb +0 -22
  88. data/lib/awesome_print/ext/active_record.rb +0 -78
  89. data/lib/awesome_print/ext/active_support.rb +0 -47
  90. data/lib/awesome_print/ext/mongo_mapper.rb +0 -124
  91. data/lib/awesome_print/ext/mongoid.rb +0 -67
  92. data/lib/awesome_print/ext/nobrainer.rb +0 -52
  93. data/lib/awesome_print/ext/nokogiri.rb +0 -45
  94. data/lib/awesome_print/ext/ostruct.rb +0 -27
  95. data/lib/awesome_print/ext/ripple.rb +0 -71
  96. data/lib/awesome_print/ext/sequel.rb +0 -58
  97. data/spec/ext/action_view_spec.rb +0 -18
  98. data/spec/ext/mongo_mapper_spec.rb +0 -261
  99. data/spec/ext/nobrainer_spec.rb +0 -59
  100. data/spec/ext/ripple_spec.rb +0 -48
  101. data/spec/formats_spec.rb +0 -779
  102. data/spec/support/active_record_data/3_2_diana.txt +0 -24
  103. data/spec/support/active_record_data/3_2_diana_legacy.txt +0 -24
  104. data/spec/support/active_record_data/3_2_multi.txt +0 -50
  105. data/spec/support/active_record_data/3_2_multi_legacy.txt +0 -50
  106. data/spec/support/active_record_data/4_0_diana.txt +0 -98
  107. data/spec/support/active_record_data/4_0_multi.txt +0 -198
  108. data/spec/support/active_record_data/4_1_diana.txt +0 -97
  109. data/spec/support/active_record_data/4_1_multi.txt +0 -196
  110. data/spec/support/active_record_data/4_2_diana.txt +0 -109
  111. data/spec/support/active_record_data/4_2_diana_legacy.txt +0 -109
  112. data/spec/support/active_record_data/4_2_multi.txt +0 -220
  113. data/spec/support/active_record_data/4_2_multi_legacy.txt +0 -220
@@ -19,21 +19,6 @@ module ExtVerifier
19
19
  defined?(Mongoid)
20
20
  end
21
21
  module_function :has_mongoid?
22
-
23
- def has_mongo_mapper?
24
- defined?(MongoMapper)
25
- end
26
- module_function :has_mongo_mapper?
27
-
28
- def has_ripple?
29
- defined?(Ripple)
30
- end
31
- module_function :has_ripple?
32
-
33
- def has_nobrainer?
34
- defined?(NoBrainer)
35
- end
36
- module_function :has_nobrainer?
37
22
  end
38
23
 
39
24
  RSpec.configure do |config|
@@ -7,12 +7,12 @@ module MongoidVersions
7
7
  Gem::Requirement.new('~> 4.0.0').satisfied_by?(mongoid_version)
8
8
  end
9
9
 
10
- def mongoid_3_0?
11
- Gem::Requirement.new('~> 3.0.0').satisfied_by?(mongoid_version)
10
+ def mongoid_5_0?
11
+ Gem::Requirement.new('~> 5.0.0').satisfied_by?(mongoid_version)
12
12
  end
13
13
 
14
- def mongoid_3_1?
15
- Gem::Requirement.new('~> 3.1.0').satisfied_by?(mongoid_version)
14
+ def mongoid_6_0?
15
+ Gem::Requirement.new('~> 6.0.0').satisfied_by?(mongoid_version)
16
16
  end
17
17
  end
18
18
 
@@ -1,32 +1,22 @@
1
1
  module RailsVersions
2
2
  def rails_version
3
- Gem::Version.new(Rails::VERSION::STRING)
3
+ Gem::Version.new(::Rails::VERSION::STRING)
4
4
  end
5
5
 
6
- def rails_5_0?
7
- Gem::Requirement.new('~> 5.0.0.racecar1').satisfied_by?(rails_version)
8
- end
9
- alias_method :activerecord_5_0?, :rails_5_0?
10
-
11
- def rails_4_2?
12
- Gem::Requirement.new('~> 4.2.0').satisfied_by?(rails_version)
6
+ def rails_5_2?
7
+ Gem::Requirement.new('~> 5.2.0').satisfied_by?(rails_version)
13
8
  end
14
- alias_method :activerecord_4_2?, :rails_4_2?
9
+ alias_method :activerecord_5_2?, :rails_5_2?
15
10
 
16
- def rails_4_1?
17
- Gem::Requirement.new('~> 4.1.0').satisfied_by?(rails_version)
11
+ def rails_5_1?
12
+ Gem::Requirement.new('~> 5.1.0').satisfied_by?(rails_version)
18
13
  end
19
- alias_method :activerecord_4_1?, :rails_4_1?
14
+ alias_method :activerecord_5_1?, :rails_5_1?
20
15
 
21
- def rails_4_0?
22
- Gem::Requirement.new('~> 4.0.0').satisfied_by?(rails_version)
23
- end
24
- alias_method :activerecord_4_0?, :rails_4_0?
25
-
26
- def rails_3_2?
27
- Gem::Requirement.new('~> 3.2.0').satisfied_by?(rails_version)
16
+ def rails_5_0?
17
+ Gem::Requirement.new('~> 5.0.0').satisfied_by?(rails_version)
28
18
  end
29
- alias_method :activerecord_3_2?, :rails_3_2?
19
+ alias_method :activerecord_5_0?, :rails_5_0?
30
20
  end
31
21
 
32
22
  RSpec.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 2.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
- - Michael Dvorkin
7
+ - Michael Dvorkin, James Cox & contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: appraisal
28
+ name: fuubar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,21 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: fakefs
42
+ name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.1
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.1
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: sqlite3
56
+ name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,21 +67,21 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: nokogiri
70
+ name: fakefs
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.5
75
+ version: 0.2.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.6.5
82
+ version: 0.2.1
83
83
  - !ruby/object:Gem::Dependency
84
- name: simplecov
84
+ name: sqlite3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,22 +95,22 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: codeclimate-test-reporter
98
+ name: nokogiri
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.6.5
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
111
- description: 'Great Ruby dubugging companion: pretty print Ruby objects to visualize
110
+ version: 1.6.5
111
+ description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
112
112
  their structure. Supports custom object formatting via plugins'
113
- email: mike@dvorkin.net
113
+ email:
114
114
  executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
@@ -127,72 +127,88 @@ files:
127
127
  - lib/ap.rb
128
128
  - lib/awesome_print.rb
129
129
  - lib/awesome_print/colorize.rb
130
+ - lib/awesome_print/core_ext/active_support.rb
130
131
  - lib/awesome_print/core_ext/awesome_method_array.rb
131
132
  - lib/awesome_print/core_ext/class.rb
132
133
  - lib/awesome_print/core_ext/kernel.rb
133
134
  - lib/awesome_print/core_ext/logger.rb
134
- - lib/awesome_print/core_ext/method.rb
135
135
  - lib/awesome_print/core_ext/object.rb
136
136
  - lib/awesome_print/core_ext/string.rb
137
137
  - lib/awesome_print/custom_defaults.rb
138
- - lib/awesome_print/ext/action_view.rb
139
- - lib/awesome_print/ext/active_record.rb
140
- - lib/awesome_print/ext/active_support.rb
141
- - lib/awesome_print/ext/mongo_mapper.rb
142
- - lib/awesome_print/ext/mongoid.rb
143
- - lib/awesome_print/ext/nobrainer.rb
144
- - lib/awesome_print/ext/nokogiri.rb
145
- - lib/awesome_print/ext/ostruct.rb
146
- - lib/awesome_print/ext/ripple.rb
147
- - lib/awesome_print/ext/sequel.rb
148
138
  - lib/awesome_print/formatter.rb
149
139
  - lib/awesome_print/formatters.rb
150
140
  - lib/awesome_print/formatters/array_formatter.rb
151
141
  - lib/awesome_print/formatters/base_formatter.rb
142
+ - lib/awesome_print/formatters/bigdecimal_formatter.rb
152
143
  - lib/awesome_print/formatters/class_formatter.rb
153
144
  - lib/awesome_print/formatters/dir_formatter.rb
145
+ - lib/awesome_print/formatters/ext/active_model_error_formatter.rb
146
+ - lib/awesome_print/formatters/ext/active_record_attributeset_formatter.rb
147
+ - lib/awesome_print/formatters/ext/active_record_class_formatter.rb
148
+ - lib/awesome_print/formatters/ext/active_record_instance_formatter.rb
149
+ - lib/awesome_print/formatters/ext/active_record_relation_formatter.rb
150
+ - lib/awesome_print/formatters/ext/bson_objectid_formatter.rb
151
+ - lib/awesome_print/formatters/ext/hash_with_indifferent_access_formatter.rb
152
+ - lib/awesome_print/formatters/ext/mongoid_document_formatter.rb
153
+ - lib/awesome_print/formatters/ext/nokogiri_document_formatter.rb
154
+ - lib/awesome_print/formatters/ext/nokogiri_node_formatter.rb
155
+ - lib/awesome_print/formatters/ext/nokogiri_nodeset_formatter.rb
156
+ - lib/awesome_print/formatters/ext/sequel_dataset_formatter.rb
157
+ - lib/awesome_print/formatters/ext/sequel_model_class_formatter.rb
158
+ - lib/awesome_print/formatters/ext/sequel_model_formatter.rb
159
+ - lib/awesome_print/formatters/ext/time_with_zone_formatter.rb
160
+ - lib/awesome_print/formatters/fallback_formatter.rb
161
+ - lib/awesome_print/formatters/false_class_formatter.rb
154
162
  - lib/awesome_print/formatters/file_formatter.rb
155
163
  - lib/awesome_print/formatters/hash_formatter.rb
164
+ - lib/awesome_print/formatters/integer_formatter.rb
156
165
  - lib/awesome_print/formatters/method_formatter.rb
166
+ - lib/awesome_print/formatters/module_formatter.rb
167
+ - lib/awesome_print/formatters/nil_class_formatter.rb
157
168
  - lib/awesome_print/formatters/object_formatter.rb
169
+ - lib/awesome_print/formatters/open_struct.rb
170
+ - lib/awesome_print/formatters/range_formatter.rb
171
+ - lib/awesome_print/formatters/rational_formatter.rb
172
+ - lib/awesome_print/formatters/set_formatter.rb
158
173
  - lib/awesome_print/formatters/simple_formatter.rb
174
+ - lib/awesome_print/formatters/string_formatter.rb
159
175
  - lib/awesome_print/formatters/struct_formatter.rb
176
+ - lib/awesome_print/formatters/symbol_formatter.rb
177
+ - lib/awesome_print/formatters/true_class_formatter.rb
178
+ - lib/awesome_print/formatters/unbound_method_formatter.rb
160
179
  - lib/awesome_print/indentator.rb
161
180
  - lib/awesome_print/inspector.rb
181
+ - lib/awesome_print/limiter.rb
182
+ - lib/awesome_print/registrar.rb
162
183
  - lib/awesome_print/version.rb
163
184
  - spec/active_record_helper.rb
164
185
  - spec/colors_spec.rb
165
186
  - spec/core_ext/logger_spec.rb
166
187
  - spec/core_ext/string_spec.rb
167
- - spec/ext/action_view_spec.rb
168
- - spec/ext/active_record_spec.rb
169
- - spec/ext/active_support_spec.rb
170
- - spec/ext/mongo_mapper_spec.rb
171
- - spec/ext/mongoid_spec.rb
172
- - spec/ext/nobrainer_spec.rb
173
- - spec/ext/nokogiri_spec.rb
174
- - spec/ext/ostruct_spec.rb
175
- - spec/ext/ripple_spec.rb
176
- - spec/formats_spec.rb
177
- - spec/methods_spec.rb
188
+ - spec/formatters/array_spec.rb
189
+ - spec/formatters/big_decimal_spec.rb
190
+ - spec/formatters/class_spec.rb
191
+ - spec/formatters/dir_file_spec.rb
192
+ - spec/formatters/ext/active_record_spec.rb
193
+ - spec/formatters/ext/active_support_spec.rb
194
+ - spec/formatters/ext/mongoid_spec.rb
195
+ - spec/formatters/ext/nokogiri_spec.rb
196
+ - spec/formatters/hash_spec.rb
197
+ - spec/formatters/methods_spec.rb
198
+ - spec/formatters/objects_spec.rb
199
+ - spec/formatters/ostruct_spec.rb
200
+ - spec/formatters/set_spec.rb
201
+ - spec/formatters/struct_spec.rb
202
+ - spec/merge_options_spec.rb
178
203
  - spec/misc_spec.rb
179
- - spec/objects_spec.rb
180
204
  - spec/spec_helper.rb
181
205
  - spec/support/active_record_data.rb
182
- - spec/support/active_record_data/3_2_diana.txt
183
- - spec/support/active_record_data/3_2_diana_legacy.txt
184
- - spec/support/active_record_data/3_2_multi.txt
185
- - spec/support/active_record_data/3_2_multi_legacy.txt
186
- - spec/support/active_record_data/4_0_diana.txt
187
- - spec/support/active_record_data/4_0_multi.txt
188
- - spec/support/active_record_data/4_1_diana.txt
189
- - spec/support/active_record_data/4_1_multi.txt
190
- - spec/support/active_record_data/4_2_diana.txt
191
- - spec/support/active_record_data/4_2_diana_legacy.txt
192
- - spec/support/active_record_data/4_2_multi.txt
193
- - spec/support/active_record_data/4_2_multi_legacy.txt
194
206
  - spec/support/active_record_data/5_0_diana.txt
195
207
  - spec/support/active_record_data/5_0_multi.txt
208
+ - spec/support/active_record_data/5_1_diana.txt
209
+ - spec/support/active_record_data/5_1_multi.txt
210
+ - spec/support/active_record_data/5_2_diana.txt
211
+ - spec/support/active_record_data/5_2_multi.txt
196
212
  - spec/support/ext_verifier.rb
197
213
  - spec/support/mongoid_versions.rb
198
214
  - spec/support/rails_versions.rb
@@ -211,49 +227,44 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
227
  version: '0'
212
228
  required_rubygems_version: !ruby/object:Gem::Requirement
213
229
  requirements:
214
- - - ">="
230
+ - - ">"
215
231
  - !ruby/object:Gem::Version
216
- version: '0'
232
+ version: 1.3.1
217
233
  requirements: []
218
- rubyforge_project: awesome_print
219
- rubygems_version: 2.6.11
234
+ rubyforge_project:
235
+ rubygems_version: 2.6.14.1
220
236
  signing_key:
221
237
  specification_version: 4
222
238
  summary: Pretty print Ruby objects with proper indentation and colors
223
239
  test_files:
224
- - spec/active_record_helper.rb
225
- - spec/colors_spec.rb
240
+ - spec/spec_helper.rb
241
+ - spec/merge_options_spec.rb
226
242
  - spec/core_ext/logger_spec.rb
227
243
  - spec/core_ext/string_spec.rb
228
- - spec/ext/action_view_spec.rb
229
- - spec/ext/active_record_spec.rb
230
- - spec/ext/active_support_spec.rb
231
- - spec/ext/mongo_mapper_spec.rb
232
- - spec/ext/mongoid_spec.rb
233
- - spec/ext/nobrainer_spec.rb
234
- - spec/ext/nokogiri_spec.rb
235
- - spec/ext/ostruct_spec.rb
236
- - spec/ext/ripple_spec.rb
237
- - spec/formats_spec.rb
238
- - spec/methods_spec.rb
239
- - spec/misc_spec.rb
240
- - spec/objects_spec.rb
241
- - spec/spec_helper.rb
242
- - spec/support/active_record_data/3_2_diana.txt
243
- - spec/support/active_record_data/3_2_diana_legacy.txt
244
- - spec/support/active_record_data/3_2_multi.txt
245
- - spec/support/active_record_data/3_2_multi_legacy.txt
246
- - spec/support/active_record_data/4_0_diana.txt
247
- - spec/support/active_record_data/4_0_multi.txt
248
- - spec/support/active_record_data/4_1_diana.txt
249
- - spec/support/active_record_data/4_1_multi.txt
250
- - spec/support/active_record_data/4_2_diana.txt
251
- - spec/support/active_record_data/4_2_diana_legacy.txt
252
- - spec/support/active_record_data/4_2_multi.txt
253
- - spec/support/active_record_data/4_2_multi_legacy.txt
254
- - spec/support/active_record_data/5_0_diana.txt
244
+ - spec/colors_spec.rb
245
+ - spec/formatters/big_decimal_spec.rb
246
+ - spec/formatters/array_spec.rb
247
+ - spec/formatters/set_spec.rb
248
+ - spec/formatters/hash_spec.rb
249
+ - spec/formatters/ext/active_support_spec.rb
250
+ - spec/formatters/ext/mongoid_spec.rb
251
+ - spec/formatters/ext/active_record_spec.rb
252
+ - spec/formatters/ext/nokogiri_spec.rb
253
+ - spec/formatters/methods_spec.rb
254
+ - spec/formatters/dir_file_spec.rb
255
+ - spec/formatters/objects_spec.rb
256
+ - spec/formatters/struct_spec.rb
257
+ - spec/formatters/ostruct_spec.rb
258
+ - spec/formatters/class_spec.rb
259
+ - spec/active_record_helper.rb
260
+ - spec/support/mongoid_versions.rb
255
261
  - spec/support/active_record_data/5_0_multi.txt
256
- - spec/support/active_record_data.rb
262
+ - spec/support/active_record_data/5_2_diana.txt
263
+ - spec/support/active_record_data/5_1_multi.txt
264
+ - spec/support/active_record_data/5_1_diana.txt
265
+ - spec/support/active_record_data/5_2_multi.txt
266
+ - spec/support/active_record_data/5_0_diana.txt
257
267
  - spec/support/ext_verifier.rb
258
- - spec/support/mongoid_versions.rb
259
268
  - spec/support/rails_versions.rb
269
+ - spec/support/active_record_data.rb
270
+ - spec/misc_spec.rb
@@ -1,21 +0,0 @@
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
- # Method#name was intorduced in Ruby 1.8.7 so we define it here as necessary.
8
- #
9
- unless nil.method(:class).respond_to?(:name)
10
- class Method
11
- def name
12
- inspect.split(/[#.>]/)[-1]
13
- end
14
- end
15
-
16
- class UnboundMethod
17
- def name
18
- inspect.split(/[#.>]/)[-1]
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
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
- module AwesomePrint
7
- module ActionView
8
- # Use HTML colors and add default "debug_dump" class to the resulting HTML.
9
- def ap_debug(object, options = {})
10
- object.ai(
11
- options.merge(html: true)
12
- ).sub(
13
- /^<pre([\s>])/,
14
- '<pre class="debug_dump"\\1'
15
- )
16
- end
17
-
18
- alias ap ap_debug
19
- end
20
- end
21
-
22
- ActionView::Base.send(:include, AwesomePrint::ActionView)
@@ -1,78 +0,0 @@
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
- module AwesomePrint
7
- module ActiveRecord
8
-
9
- def self.included(base)
10
- base.send :alias_method, :cast_without_active_record, :cast
11
- base.send :alias_method, :cast, :cast_with_active_record
12
- end
13
-
14
- # Add ActiveRecord class names to the dispatcher pipeline.
15
- #------------------------------------------------------------------------------
16
- def cast_with_active_record(object, type)
17
- cast = cast_without_active_record(object, type)
18
- return cast if !defined?(::ActiveRecord::Base)
19
-
20
- if object.is_a?(::ActiveRecord::Base)
21
- cast = :active_record_instance
22
- elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
23
- cast = :active_record_class
24
- elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation)
25
- cast = :array
26
- end
27
- cast
28
- end
29
-
30
- private
31
-
32
- # Format ActiveRecord instance object.
33
- #
34
- # NOTE: by default only instance attributes (i.e. columns) are shown. To format
35
- # ActiveRecord instance as regular object showing its instance variables and
36
- # accessors use :raw => true option:
37
- #
38
- # ap record, :raw => true
39
- #
40
- #------------------------------------------------------------------------------
41
- def awesome_active_record_instance(object)
42
- return object.inspect if !defined?(::ActiveSupport::OrderedHash)
43
- return awesome_object(object) if @options[:raw]
44
-
45
- data = if object.class.column_names != object.attributes.keys
46
- object.attributes
47
- else
48
- object.class.column_names.inject(::ActiveSupport::OrderedHash.new) do |hash, name|
49
- if object.has_attribute?(name) || object.new_record?
50
- value = object.respond_to?(name) ? object.send(name) : object.read_attribute(name)
51
- hash[name.to_sym] = value
52
- end
53
- hash
54
- end
55
- end
56
- "#{object} " << awesome_hash(data)
57
- end
58
-
59
- # Format ActiveRecord class object.
60
- #------------------------------------------------------------------------------
61
- def awesome_active_record_class(object)
62
- return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:columns) || object.to_s == 'ActiveRecord::Base'
63
- return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class?
64
-
65
- data = object.columns.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
66
- hash[c.name.to_sym] = c.type
67
- hash
68
- end
69
-
70
- name = "class #{awesome_simple(object.to_s, :class)}"
71
- base = "< #{awesome_simple(object.superclass.to_s, :class)}"
72
-
73
- [name, base, awesome_hash(data)].join(' ')
74
- end
75
- end
76
- end
77
-
78
- AwesomePrint::Formatter.send(:include, AwesomePrint::ActiveRecord)