muesli 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/muesli/adapters/rack_cache.rb +13 -0
- data/lib/muesli/serializers/base.rb +12 -3
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7f19a08f4b26660bcdacf136c51d3dcf633cff6
|
4
|
+
data.tar.gz: dd88ad4e223ab62f9eabd3dd7c2150c316031c37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48204ca4d266fc21d197a3d30a357f969604ca68e2e118daacb015752d38b5539fde97831bb78ec57e9eb8976c83ea8e41f1a6bc401a750c888a58502e581177
|
7
|
+
data.tar.gz: 1f7416429b01b0522218a4e617a61dc0b7e2727595b01f22d99415d40f980d93c24dafc8858efcbe2438ce2a70937c2e10f3b1eadd056f7d06fd9d2e2a17c52e
|
@@ -22,9 +22,18 @@ module Muesli
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def serialize_attributes(attribute_source, attribute_list)
|
25
|
-
return attribute_list.
|
26
|
-
|
27
|
-
|
25
|
+
return attribute_list.map do |attr|
|
26
|
+
map_from_source(attribute_source, attr)
|
27
|
+
end.compact.to_h
|
28
|
+
end
|
29
|
+
|
30
|
+
def map_from_source(attribute_source, attr)
|
31
|
+
if attribute_source.respond_to?(attr)
|
32
|
+
begin
|
33
|
+
[ attr, serialize_value( attribute_source.send(attr) ) ]
|
34
|
+
rescue ActiveModel::MissingAttributeError
|
35
|
+
nil
|
36
|
+
end
|
28
37
|
end
|
29
38
|
end
|
30
39
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muesli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Connor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Provides serialization of models into hashes with
|
14
|
-
and
|
13
|
+
description: Provides class-based recursive serialization of models into hashes with
|
14
|
+
attribute whitelisting and conditionals for passing to views or as an API response.
|
15
15
|
email: danconn@danconnor.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- lib/muesli.rb
|
21
21
|
- lib/muesli/adapters/cancan.rb
|
22
|
+
- lib/muesli/adapters/rack_cache.rb
|
22
23
|
- lib/muesli/attribute_serializers/base.rb
|
23
24
|
- lib/muesli/attribute_serializers/bson_objectid.rb
|
24
25
|
- lib/muesli/attribute_serializers/date.rb
|
@@ -49,6 +50,6 @@ rubyforge_project:
|
|
49
50
|
rubygems_version: 2.2.2
|
50
51
|
signing_key:
|
51
52
|
specification_version: 4
|
52
|
-
summary: Provides serialization of models into hashes with attribute
|
53
|
-
and
|
53
|
+
summary: Provides class-based recursive serialization of models into hashes with attribute
|
54
|
+
whitelisting and conditionals for passing to views or as an API response.
|
54
55
|
test_files: []
|