contracts 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. data/lib/contracts.rb +9 -1
  2. metadata +3 -3
data/lib/contracts.rb CHANGED
@@ -5,6 +5,11 @@ class Class
5
5
  include MethodDecorators
6
6
  end
7
7
 
8
+ class Module
9
+ include MethodDecorators
10
+ end
11
+
12
+
8
13
  # This is the main Contract class. When you write a new contract, you'll
9
14
  # write it as:
10
15
  #
@@ -83,7 +88,10 @@ class Contract < Decorator
83
88
  # e.g. [Num, String]
84
89
  # TODO account for these errors too
85
90
  return mkerror(false, arg, contract) unless arg.is_a?(Array)
86
- validate_all(arg, contract)
91
+ arg.zip(contract).each do |_arg, _contract|
92
+ res, info = valid?(_arg, _contract)
93
+ return mkerror(false, arg, contract) unless res
94
+ end
87
95
  when Hash
88
96
  # e.g. { :a => Num, :b => String }
89
97
  return mkerror(false, arg, contract) unless arg.is_a?(Hash)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contracts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aditya Bhargava