representable 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +17 -0
  3. data/CHANGES.md +25 -0
  4. data/Gemfile +4 -12
  5. data/LICENSE +1 -1
  6. data/README.md +6 -6
  7. data/Rakefile +1 -6
  8. data/TODO +1 -3
  9. data/TODO-4.0.md +72 -0
  10. data/lib/representable.rb +19 -25
  11. data/lib/representable/binding.rb +32 -12
  12. data/lib/representable/cached.rb +1 -1
  13. data/lib/representable/coercion.rb +8 -6
  14. data/lib/representable/config.rb +13 -3
  15. data/lib/representable/debug.rb +23 -15
  16. data/lib/representable/declarative.rb +12 -7
  17. data/lib/representable/decorator.rb +1 -1
  18. data/lib/representable/definition.rb +7 -3
  19. data/lib/representable/deserializer.rb +5 -4
  20. data/lib/representable/for_collection.rb +1 -1
  21. data/lib/representable/hash.rb +9 -2
  22. data/lib/representable/hash/allow_symbols.rb +9 -11
  23. data/lib/representable/hash/binding.rb +1 -0
  24. data/lib/representable/hash/collection.rb +4 -2
  25. data/lib/representable/hash_methods.rb +3 -2
  26. data/lib/representable/insert.rb +1 -1
  27. data/lib/representable/json.rb +8 -7
  28. data/lib/representable/json/collection.rb +3 -0
  29. data/lib/representable/object.rb +1 -1
  30. data/lib/representable/object/binding.rb +5 -1
  31. data/lib/representable/option.rb +19 -0
  32. data/lib/representable/pipeline.rb +3 -2
  33. data/lib/representable/pipeline_factories.rb +4 -2
  34. data/lib/representable/populator.rb +1 -1
  35. data/lib/representable/represent.rb +1 -0
  36. data/lib/representable/serializer.rb +3 -2
  37. data/lib/representable/version.rb +1 -1
  38. data/lib/representable/virtus_coercion.rb +38 -0
  39. data/lib/representable/xml.rb +12 -10
  40. data/lib/representable/xml/binding.rb +19 -13
  41. data/lib/representable/xml/namespace.rb +122 -0
  42. data/lib/representable/yaml.rb +6 -2
  43. data/lib/representable/yaml/binding.rb +1 -0
  44. data/representable.gemspec +8 -9
  45. data/test/as_test.rb +7 -7
  46. data/test/binding_test.rb +14 -14
  47. data/test/cached_test.rb +59 -49
  48. data/test/class_test.rb +9 -9
  49. data/test/coercion_test.rb +33 -22
  50. data/test/config/inherit_test.rb +14 -14
  51. data/test/config_test.rb +20 -20
  52. data/test/decorator_scope_test.rb +4 -4
  53. data/test/decorator_test.rb +33 -20
  54. data/test/default_test.rb +8 -8
  55. data/test/defaults_options_test.rb +3 -3
  56. data/test/definition_test.rb +38 -40
  57. data/test/{example.rb → examples/example.rb} +0 -1
  58. data/test/examples/object.rb +1 -5
  59. data/test/exec_context_test.rb +8 -8
  60. data/test/features_test.rb +6 -6
  61. data/test/filter_test.rb +8 -8
  62. data/test/for_collection_test.rb +10 -10
  63. data/test/generic_test.rb +13 -13
  64. data/test/getter_setter_test.rb +5 -5
  65. data/test/hash_bindings_test.rb +1 -1
  66. data/test/hash_test.rb +45 -23
  67. data/test/heritage_test.rb +16 -13
  68. data/test/if_test.rb +9 -9
  69. data/test/include_exclude_test.rb +14 -14
  70. data/test/inherit_test.rb +18 -18
  71. data/test/inline_test.rb +24 -24
  72. data/test/instance_test.rb +31 -31
  73. data/test/is_representable_test.rb +10 -10
  74. data/test/json_test.rb +29 -7
  75. data/test/lonely_test.rb +31 -31
  76. data/test/nested_test.rb +13 -13
  77. data/test/object_test.rb +9 -9
  78. data/test/option_test.rb +36 -0
  79. data/test/parse_pipeline_test.rb +3 -5
  80. data/test/pipeline_test.rb +50 -50
  81. data/test/populator_test.rb +18 -18
  82. data/test/prepare_test.rb +4 -4
  83. data/test/private_options_test.rb +2 -2
  84. data/test/reader_writer_test.rb +2 -2
  85. data/test/render_nil_test.rb +2 -2
  86. data/test/represent_test.rb +14 -14
  87. data/test/representable_test.rb +34 -36
  88. data/test/schema_test.rb +8 -11
  89. data/test/serialize_deserialize_test.rb +2 -2
  90. data/test/skip_test.rb +14 -14
  91. data/test/stringify_hash_test.rb +3 -3
  92. data/test/test_helper.rb +26 -14
  93. data/test/uncategorized_test.rb +10 -10
  94. data/test/user_options_test.rb +4 -4
  95. data/test/virtus_coercion_test.rb +52 -0
  96. data/test/wrap_test.rb +19 -19
  97. data/test/xml_bindings_test.rb +0 -4
  98. data/test/xml_namespace_test.rb +186 -0
  99. data/test/xml_test.rb +103 -43
  100. data/test/yaml_test.rb +51 -26
  101. metadata +101 -39
  102. data/.travis.yml +0 -7
  103. data/lib/representable/TODO.getting_serious +0 -11
  104. data/lib/representable/autoload.rb +0 -10
  105. data/test/mongoid_test.rb +0 -31
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: representable
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-19 00:00:00.000000000 Z
11
+ date: 2021-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.15
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.15
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: declarative
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "<"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: trailblazer-option
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.0.5
47
+ version: 0.1.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 0.0.5
54
+ version: 0.1.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -56,14 +70,14 @@ dependencies:
56
70
  name: test_xml
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: 0.1.6
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 0.1.6
69
83
  - !ruby/object:Gem::Dependency
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: mongoid
98
+ name: virtus
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,7 +109,7 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: virtus
112
+ name: dry-types
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -108,20 +122,6 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: json
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: 1.7.7
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: 1.7.7
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: ruby-prof
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -144,17 +144,16 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - ".github/workflows/ci.yml"
147
148
  - ".gitignore"
148
- - ".travis.yml"
149
149
  - CHANGES.md
150
150
  - Gemfile
151
151
  - LICENSE
152
152
  - README.md
153
153
  - Rakefile
154
154
  - TODO
155
+ - TODO-4.0.md
155
156
  - lib/representable.rb
156
- - lib/representable/TODO.getting_serious
157
- - lib/representable/autoload.rb
158
157
  - lib/representable/binding.rb
159
158
  - lib/representable/cached.rb
160
159
  - lib/representable/coercion.rb
@@ -176,16 +175,19 @@ files:
176
175
  - lib/representable/json/hash.rb
177
176
  - lib/representable/object.rb
178
177
  - lib/representable/object/binding.rb
178
+ - lib/representable/option.rb
179
179
  - lib/representable/pipeline.rb
180
180
  - lib/representable/pipeline_factories.rb
181
181
  - lib/representable/populator.rb
182
182
  - lib/representable/represent.rb
183
183
  - lib/representable/serializer.rb
184
184
  - lib/representable/version.rb
185
+ - lib/representable/virtus_coercion.rb
185
186
  - lib/representable/xml.rb
186
187
  - lib/representable/xml/binding.rb
187
188
  - lib/representable/xml/collection.rb
188
189
  - lib/representable/xml/hash.rb
190
+ - lib/representable/xml/namespace.rb
189
191
  - lib/representable/yaml.rb
190
192
  - lib/representable/yaml/binding.rb
191
193
  - representable.gemspec
@@ -202,7 +204,7 @@ files:
202
204
  - test/default_test.rb
203
205
  - test/defaults_options_test.rb
204
206
  - test/definition_test.rb
205
- - test/example.rb
207
+ - test/examples/example.rb
206
208
  - test/examples/object.rb
207
209
  - test/exec_context_test.rb
208
210
  - test/features_test.rb
@@ -221,9 +223,9 @@ files:
221
223
  - test/is_representable_test.rb
222
224
  - test/json_test.rb
223
225
  - test/lonely_test.rb
224
- - test/mongoid_test.rb
225
226
  - test/nested_test.rb
226
227
  - test/object_test.rb
228
+ - test/option_test.rb
227
229
  - test/parse_pipeline_test.rb
228
230
  - test/pipeline_test.rb
229
231
  - test/populator_test.rb
@@ -242,15 +244,17 @@ files:
242
244
  - test/test_helper_test.rb
243
245
  - test/uncategorized_test.rb
244
246
  - test/user_options_test.rb
247
+ - test/virtus_coercion_test.rb
245
248
  - test/wrap_test.rb
246
249
  - test/xml_bindings_test.rb
250
+ - test/xml_namespace_test.rb
247
251
  - test/xml_test.rb
248
252
  - test/yaml_test.rb
249
- homepage: https://github.com/apotonick/representable/
253
+ homepage: https://github.com/trailblazer/representable/
250
254
  licenses:
251
255
  - MIT
252
256
  metadata: {}
253
- post_install_message:
257
+ post_install_message:
254
258
  rdoc_options: []
255
259
  require_paths:
256
260
  - lib
@@ -258,17 +262,75 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
262
  requirements:
259
263
  - - ">="
260
264
  - !ruby/object:Gem::Version
261
- version: 1.9.3
265
+ version: 2.4.0
262
266
  required_rubygems_version: !ruby/object:Gem::Requirement
263
267
  requirements:
264
268
  - - ">="
265
269
  - !ruby/object:Gem::Version
266
270
  version: '0'
267
271
  requirements: []
268
- rubyforge_project:
269
- rubygems_version: 2.4.8
270
- signing_key:
272
+ rubygems_version: 3.0.8
273
+ signing_key:
271
274
  specification_version: 4
272
275
  summary: Renders and parses JSON/XML/YAML documents from and to Ruby objects. Includes
273
276
  plain properties, collections, nesting, coercion and more.
274
- test_files: []
277
+ test_files:
278
+ - test/as_test.rb
279
+ - test/benchmarking.rb
280
+ - test/binding_test.rb
281
+ - test/cached_test.rb
282
+ - test/class_test.rb
283
+ - test/coercion_test.rb
284
+ - test/config/inherit_test.rb
285
+ - test/config_test.rb
286
+ - test/decorator_scope_test.rb
287
+ - test/decorator_test.rb
288
+ - test/default_test.rb
289
+ - test/defaults_options_test.rb
290
+ - test/definition_test.rb
291
+ - test/examples/example.rb
292
+ - test/examples/object.rb
293
+ - test/exec_context_test.rb
294
+ - test/features_test.rb
295
+ - test/filter_test.rb
296
+ - test/for_collection_test.rb
297
+ - test/generic_test.rb
298
+ - test/getter_setter_test.rb
299
+ - test/hash_bindings_test.rb
300
+ - test/hash_test.rb
301
+ - test/heritage_test.rb
302
+ - test/if_test.rb
303
+ - test/include_exclude_test.rb
304
+ - test/inherit_test.rb
305
+ - test/inline_test.rb
306
+ - test/instance_test.rb
307
+ - test/is_representable_test.rb
308
+ - test/json_test.rb
309
+ - test/lonely_test.rb
310
+ - test/nested_test.rb
311
+ - test/object_test.rb
312
+ - test/option_test.rb
313
+ - test/parse_pipeline_test.rb
314
+ - test/pipeline_test.rb
315
+ - test/populator_test.rb
316
+ - test/prepare_test.rb
317
+ - test/private_options_test.rb
318
+ - test/reader_writer_test.rb
319
+ - test/realistic_benchmark.rb
320
+ - test/render_nil_test.rb
321
+ - test/represent_test.rb
322
+ - test/representable_test.rb
323
+ - test/schema_test.rb
324
+ - test/serialize_deserialize_test.rb
325
+ - test/skip_test.rb
326
+ - test/stringify_hash_test.rb
327
+ - test/test_helper.rb
328
+ - test/test_helper_test.rb
329
+ - test/uncategorized_test.rb
330
+ - test/user_options_test.rb
331
+ - test/virtus_coercion_test.rb
332
+ - test/wrap_test.rb
333
+ - test/xml_bindings_test.rb
334
+ - test/xml_namespace_test.rb
335
+ - test/xml_test.rb
336
+ - test/yaml_test.rb
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - 2.1.1
5
- - 2.2.3
6
- before_install:
7
- - gem install bundler
@@ -1,11 +0,0 @@
1
- * Cleanup the manifest part in Decorator.
2
-
3
- * all property objects should be extended/wrapped so we don't need the switch.
4
-
5
- # Deprecations
6
-
7
- * deprecate instance: { nil } which is superseded by parse_strategy: :sync
8
-
9
-
10
-
11
- from_hash, property :band, class: vergessen
@@ -1,10 +0,0 @@
1
- module Representable
2
- autoload :Hash, 'representable/hash'
3
-
4
- module Hash
5
- autoload :AllowSymbols, 'representable/hash/allow_symbols'
6
- autoload :Collection, 'representable/hash/collection'
7
- end
8
-
9
- autoload :Decorator, 'representable/decorator'
10
- end
data/test/mongoid_test.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
- require 'mongoid'
3
- require 'mongoid/document'
4
-
5
- class MongoidTest < MiniTest::Spec
6
- describe "Mongoid compatibility" do
7
- it "allows #to_json" do
8
- class Profile
9
- include Mongoid::Document
10
- field :name
11
- end
12
-
13
- class Dude
14
- include Mongoid::Document
15
- embeds_one :profile, :class_name => "MongoidTest::Profile"
16
- end
17
-
18
- module ProfileRepresenter
19
- include Representable::JSON
20
-
21
- property :name
22
- end
23
-
24
- dude = Dude.new
25
- dude.profile = Profile.new
26
- dude.profile.name = "Kofi"
27
-
28
- assert_equal "{\"name\":\"Kofi\"}", dude.profile.extend(ProfileRepresenter).to_json
29
- end
30
- end
31
- end