typestrict 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/base.rb +16 -0
  2. data/lib/typestrict.rb +1 -1
  3. 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
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), 'base')
2
2
  require File.join(File.dirname(__FILE__), 'supertypes')
3
3
 
4
4
  module Strict
5
- VERSION = '0.0.10'
5
+ VERSION = '0.0.11'
6
6
  include Strict::Base
7
7
  include Strict::SuperTypes
8
8
  end
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Raeez Lorgat