contracts 0.1.1 → 0.1.2
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.
- data/lib/contracts.rb +2 -2
- data/lib/foo.rb +4 -8
- metadata +3 -3
data/lib/contracts.rb
CHANGED
@@ -113,7 +113,7 @@ class Contract < Decorator
|
|
113
113
|
validate_hash(arg, contract)
|
114
114
|
when Contracts::Args
|
115
115
|
valid? arg, contract.contract
|
116
|
-
when Func
|
116
|
+
when Contracts::Func
|
117
117
|
arg.is_a?(Method) || arg.is_a?(Proc)
|
118
118
|
else
|
119
119
|
if contract.respond_to? :valid?
|
@@ -140,7 +140,7 @@ class Contract < Decorator
|
|
140
140
|
# contracts on methods
|
141
141
|
|
142
142
|
contracts.each_with_index do |contract, i|
|
143
|
-
if contract.is_a? Func
|
143
|
+
if contract.is_a? Contracts::Func
|
144
144
|
args[i] = Contract.new(@klass, args[i], *contract.contracts)
|
145
145
|
end
|
146
146
|
end
|
data/lib/foo.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require 'contracts'
|
2
2
|
include Contracts
|
3
3
|
|
4
|
-
Contract
|
5
|
-
def
|
6
|
-
|
7
|
-
arr.each do |x|
|
8
|
-
ret << func[x]
|
9
|
-
end
|
10
|
-
ret
|
4
|
+
Contract None => Num
|
5
|
+
def add
|
6
|
+
4
|
11
7
|
end
|
12
8
|
|
13
|
-
p
|
9
|
+
p add
|
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Bhargava
|