restpack_serializer 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1a8ecbc65ea8b809a06673e5ef2384b5604bf83
4
- data.tar.gz: 53ae8aaec67aecff3a180d47574db826419f1f82
3
+ metadata.gz: 2020691b4623c0b58df86ecceea26246293f9437
4
+ data.tar.gz: 54788f45514f191808b5c4a7c7280775fb60807d
5
5
  SHA512:
6
- metadata.gz: 64020419cc8a025d86b568c63b2a6d3efbcd422a19a1cc17133a0676a536e0307e18074e81be9d35bb24c862c10ff685c81984a17b81c6a271c713c2f8c36cde
7
- data.tar.gz: a33dd4d6cb45d530ae2520dbf01675e4ebf8896f7b3bf2d17e322a044930a27b7d412fcdbe6d83b272e739a1c766c7db7860d7e404da8af26ebe2652c48863f3
6
+ metadata.gz: fcac1147825f4ea7d1f74e684e10b596c95d07faa2873272824be9a34391565d991e8f6e65cc94bef97a60357df358047334f45e86a97bd0dd4b2248f41dd9ad
7
+ data.tar.gz: 8a6bf2bfb3e2aad290469ad4c907c8af2fcb0e8039ac8bf0d2ff539a1c0bce0ac3a49bf499238ab6366180ac7ec2c2e98c1907c1913e19722678645a166e4ede
@@ -7,7 +7,6 @@ require_relative "serializable/resource"
7
7
  require_relative "serializable/single"
8
8
  require_relative "serializable/side_loading"
9
9
  require_relative "serializable/side_load_data_builder"
10
- require_relative "serializable/symbolizer"
11
10
  require_relative "serializable/sortable"
12
11
 
13
12
  module RestPack
@@ -53,11 +52,6 @@ module RestPack
53
52
  data
54
53
  end
55
54
 
56
- def as_json_symbolized(model, context = {})
57
- data = as_json(model, context)
58
- Symbolizer.recursive_symbolize(data)
59
- end
60
-
61
55
  def custom_attributes
62
56
  {}
63
57
  end
@@ -104,10 +98,6 @@ module RestPack
104
98
  new.as_json(model, context)
105
99
  end
106
100
 
107
- def as_json_symbolized(model, context = {})
108
- new.as_json_symbolized(model, context)
109
- end
110
-
111
101
  def serialize(models, context = {})
112
102
  models = [models] unless models.kind_of?(Array)
113
103
 
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.6.2'
3
+ VERSION = '0.6.3'
4
4
  end
5
5
  end
@@ -201,22 +201,6 @@ describe RestPack::Serializer do
201
201
  end
202
202
  end
203
203
  end
204
-
205
- describe ".as_json_symbolized" do
206
- it "symbolizes keys recursively" do
207
- serializer.as_json_symbolized(person, { is_ben?: true }).should == {
208
- id: '123', name: 'Gavin', description: 'This is person #123',
209
- href: '/people/123', custom_key: 'custom value for model id 123',
210
- string_keys: {
211
- kid_b: "Ben",
212
- likes: {
213
- foods: ["crackers", "stawberries"],
214
- books: ["Dumpy", "That's Not My Tiger"]
215
- }
216
- }
217
- }
218
- end
219
- end
220
204
  end
221
205
 
222
206
  describe "#model_class" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
@@ -220,7 +220,6 @@ files:
220
220
  - lib/restpack_serializer/serializable/side_loading.rb
221
221
  - lib/restpack_serializer/serializable/single.rb
222
222
  - lib/restpack_serializer/serializable/sortable.rb
223
- - lib/restpack_serializer/serializable/symbolizer.rb
224
223
  - lib/restpack_serializer/version.rb
225
224
  - performance/perf.rb
226
225
  - restpack_serializer.gemspec
@@ -1,20 +0,0 @@
1
- class Symbolizer
2
- def self.recursive_symbolize(hash)
3
- {}.tap do |h|
4
- hash.each { |key, value| h[key.to_sym] = self.map_value(value) }
5
- end
6
- end
7
-
8
- private
9
-
10
- def self.map_value(thing)
11
- case thing
12
- when Hash
13
- self.recursive_symbolize(thing)
14
- when Array
15
- thing.map { |v| map_value(v) }
16
- else
17
- thing
18
- end
19
- end
20
- end