schemad 1.0.4 → 1.1.0
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/schemad/normalizer.rb +2 -2
- data/lib/schemad/version.rb +1 -1
- data/spec/normalizer_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22dcfa91d419a8bdb46c62d976fe058d56d570ad
|
4
|
+
data.tar.gz: a7f0d85297f614c3e8c36e979cea5f3b76fb3739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cfd1025e821061912028591b4fb83fe0927f0ddbf1344c31b346abc5e35ae822f251e12f319ddab64c6b291966f75b91ff9ec7c70b5ee07af457eacf2f040e9
|
7
|
+
data.tar.gz: 5c0bbfcabf696977922b6aafaac7ac663acda55635191093c4de6b83f844b35664d47252853e367158af73e154c8c72964aae775fc2ad948e03c7270151be8a2
|
data/lib/schemad/normalizer.rb
CHANGED
@@ -13,7 +13,7 @@ module Schemad
|
|
13
13
|
subclass.instance_variable_set(:@allowed_attributes, [])
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.include_fields(fields)
|
16
|
+
def self.include_fields(*fields)
|
17
17
|
@allowed_attributes.concat fields
|
18
18
|
end
|
19
19
|
|
@@ -90,4 +90,4 @@ module Schemad
|
|
90
90
|
self.class.normalizer_method_name(field)
|
91
91
|
end
|
92
92
|
end
|
93
|
-
end
|
93
|
+
end
|
data/lib/schemad/version.rb
CHANGED
data/spec/normalizer_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Schemad::Normalizer do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context "additional fields" do
|
38
|
-
Given { normalizer.class.include_fields
|
38
|
+
Given { normalizer.class.include_fields :beasts, :cool }
|
39
39
|
When(:normalized) { normalizer.normalize(data) }
|
40
40
|
|
41
41
|
context "can be specified" do
|
@@ -100,11 +100,11 @@ describe Schemad::Normalizer do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
context "can allow fields from nested data" do
|
103
|
-
Given { BucketNormalizer.include_fields
|
103
|
+
Given { BucketNormalizer.include_fields "author/user/display_name" }
|
104
104
|
Given(:normalizer) { BucketNormalizer.new }
|
105
105
|
When(:results) { normalizer.normalize(data) }
|
106
106
|
Then { results[:display_name].should == "Joseph Walton" }
|
107
107
|
end
|
108
108
|
|
109
109
|
end
|
110
|
-
end
|
110
|
+
end
|