hash_attribute_assignment 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hash_attribute_assignment.rb +1 -2
- data/lib/hash_attribute_assignment/version.rb +1 -1
- 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: fef78ba634ed9ffefa2b658199e4ca30c8a4ce99
|
4
|
+
data.tar.gz: d07592280f4d839e688e9e84531cd7142216b1af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38dc8c5f682f02c934a7be2e597f837db8759aa47afc9cd7d4fda07441e531f2d621a8d1f94b1078ab35e642617e485401891aa5ffa682963a7d7794b6743254
|
7
|
+
data.tar.gz: aeddaf7c9d9a321ca32e4404ed01d5e94a28a99db0df4abe5fdab867ab92a5f769a0605dc8e5079d3b6bc747cf2ecf5e285677371e1a2721dee27efd9baf2859
|
@@ -13,7 +13,6 @@ module HashAttributeAssignment
|
|
13
13
|
class_variable_defined?(:@@hash_validations) ? class_variable_get(:@@hash_validations) : []
|
14
14
|
end
|
15
15
|
end
|
16
|
-
class HashValidationError < StandardError; end
|
17
16
|
class HashAttributeAssignor
|
18
17
|
def initialize(instance, hash = {})
|
19
18
|
@hash = hash
|
@@ -52,7 +51,7 @@ module HashAttributeAssignment
|
|
52
51
|
|
53
52
|
def validate_hash!
|
54
53
|
hash_validations.each do |validation|
|
55
|
-
raise
|
54
|
+
raise ArgumentError, validation.message unless validation.proc.call hash
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|