typestrict 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/base.rb +16 -0
- data/lib/typestrict.rb +1 -1
- metadata +3 -3
data/lib/base.rb
CHANGED
@@ -150,5 +150,21 @@ module Strict
|
|
150
150
|
setmode_raise!
|
151
151
|
return map
|
152
152
|
end
|
153
|
+
|
154
|
+
def enforce_map_optional!(matrix, map)
|
155
|
+
enforce_primitive!(Hash, matrix, "lib/typestrict")
|
156
|
+
enforce_primitive!(Hash, map, "lib/typestrict")
|
157
|
+
|
158
|
+
setmode_catch!
|
159
|
+
|
160
|
+
matrix.each do |param, type|
|
161
|
+
if map.has_key? param
|
162
|
+
enforce!(type, map[param], "map[#{param.inspect}]")
|
163
|
+
end
|
164
|
+
end
|
165
|
+
raise_hell!
|
166
|
+
setmode_raise!
|
167
|
+
return map
|
168
|
+
end
|
153
169
|
end
|
154
170
|
end
|
data/lib/typestrict.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typestrict
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Raeez Lorgat
|