data_contract 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_contract/contract.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f27e555f982ef09a4f72e805408545ed8cf43380
|
4
|
+
data.tar.gz: a0d62046920fe6f9b9d5d55ad359cf42443e780a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c241a18d81b53800e41ea41c6157d3fd76f20d0cde9533508d427aa12010522f6ec684686648f33dc7091399c571873cdddda8053d2b0158b221c026b9c2b11f
|
7
|
+
data.tar.gz: c3b3a9a3922652a35eea531d50b21b81f69c9cef617548fea792eac9ca7555086f2472712a34efa7fafe4cccc2c57e2a74c26af96ea236b0cec9602d18b904da
|
@@ -18,7 +18,7 @@ class DataContract < Module
|
|
18
18
|
|
19
19
|
def compatible?(other_obj)
|
20
20
|
mod.instance_methods(false).each do |m|
|
21
|
-
return false unless other_obj.respond_to?
|
21
|
+
return false unless other_obj.respond_to?(m, true)
|
22
22
|
end
|
23
23
|
return true
|
24
24
|
end
|
@@ -46,7 +46,11 @@ class DataContract < Module
|
|
46
46
|
|
47
47
|
def assign(val, receiver, attribute)
|
48
48
|
setter = "#{attribute}="
|
49
|
-
|
49
|
+
|
50
|
+
unless receiver.respond_to?(setter, true)
|
51
|
+
raise ContractError, "The #{attribute} attribute cannot be assigned to #{receiver.class.name}"
|
52
|
+
end
|
53
|
+
|
50
54
|
receiver.send setter, val
|
51
55
|
end
|
52
56
|
end
|