rschema 3.0.1.pre2 → 3.0.1.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rschema/http_coercer.rb +18 -1
- data/lib/rschema/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: 69d97f3f15a446af8d934668d8dcaf984ebd5ff3
|
4
|
+
data.tar.gz: 8894e813dea20eaa3d54437f59517dc85832612e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e188cfabcd694d114e4af241e21bea0573506dd6ae955fed3ce0a886048e1b6c567feaae8170a9ae59276c7712233381092abbe97ca8f23b115ffd8b94a4ace4
|
7
|
+
data.tar.gz: 84f09e88cd553e2f8d19d1f5ecc11ac9e31be2a17acd4838c49ef4e508624b72818bd98f8129d925ad7180fb66d6874391715e002c318c6c79892db4cca0b073
|
data/lib/rschema/http_coercer.rb
CHANGED
@@ -127,7 +127,11 @@ module RSchema
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def coerce(value)
|
130
|
-
|
130
|
+
[value]
|
131
|
+
.map(&method(:symbolize_keys))
|
132
|
+
.map(&method(:remove_extraneous_elements))
|
133
|
+
.map(&method(:default_bools_to_false))
|
134
|
+
.last
|
131
135
|
end
|
132
136
|
|
133
137
|
def symbolize_keys(hash)
|
@@ -157,6 +161,19 @@ module RSchema
|
|
157
161
|
end
|
158
162
|
end
|
159
163
|
|
164
|
+
def remove_extraneous_elements(hash)
|
165
|
+
valid_keys = hash_attributes.map(&:key)
|
166
|
+
keys_to_remove = hash.keys - valid_keys
|
167
|
+
|
168
|
+
if keys_to_remove.any?
|
169
|
+
hash.dup.tap do |stripped_hash|
|
170
|
+
keys_to_remove.each { |k| stripped_hash.delete(k) }
|
171
|
+
end
|
172
|
+
else
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
160
177
|
def default_bools_to_false(hash)
|
161
178
|
# The HTTP standard says that when a form is submitted, all unchecked
|
162
179
|
# check boxes will _not_ be sent to the server. That is, they will not
|
data/lib/rschema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rschema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.1.
|
4
|
+
version: 3.0.1.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Dalling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|