panko_serializer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/panko/serialization_descriptor.rb +28 -0
- data/lib/panko/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f8c8098047862bf6d95374b0264acc9f4f7cf13
|
|
4
|
+
data.tar.gz: 7b09699d6414c86526771627dce82453fc47ff28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a07931e1d08b72cd15d575622c0daaaf557542c982ac2b1e8b60532e917dbdc59cb10074cda132a099199f506c715e286111534139be31ef1fe614eb8bda4ab9
|
|
7
|
+
data.tar.gz: fb14a45d3e797fb15c5e5a8ebfc46685d8ff03915a1c71d5d9a7354ab6a2380f4ee1d4f7e7bf51489c8b0d646a7b3b66443591884f6d76ccec44148f20a30dc5
|
|
@@ -40,6 +40,12 @@ module Panko
|
|
|
40
40
|
attributes_only_filters, associations_only_filters = resolve_filters(options, :only)
|
|
41
41
|
attributes_except_filters, associations_except_filters = resolve_filters(options, :except)
|
|
42
42
|
|
|
43
|
+
apply_aliases_filters(
|
|
44
|
+
self.aliases,
|
|
45
|
+
attributes_only_filters,
|
|
46
|
+
attributes_except_filters
|
|
47
|
+
)
|
|
48
|
+
|
|
43
49
|
self.fields = apply_fields_filters(
|
|
44
50
|
self.fields,
|
|
45
51
|
attributes_only_filters,
|
|
@@ -133,5 +139,27 @@ module Panko
|
|
|
133
139
|
|
|
134
140
|
fields
|
|
135
141
|
end
|
|
142
|
+
|
|
143
|
+
def apply_aliases_filters(aliases, only, except)
|
|
144
|
+
return if self.aliases.nil? || self.aliases.empty?
|
|
145
|
+
|
|
146
|
+
unless only.empty?
|
|
147
|
+
only.map! do |field_name|
|
|
148
|
+
alias_name = self.aliases.key(field_name)
|
|
149
|
+
next field_name if alias_name.nil?
|
|
150
|
+
|
|
151
|
+
alias_name
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
unless except.empty?
|
|
156
|
+
except.map! do |field_name|
|
|
157
|
+
alias_name = self.aliases.key(field_name)
|
|
158
|
+
next field_name if alias_name.nil?
|
|
159
|
+
|
|
160
|
+
alias_name
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
136
164
|
end
|
|
137
165
|
end
|
data/lib/panko/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: panko_serializer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yosi Attias
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-10-
|
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|