validated_object 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/validated_object.rb +7 -4
- data/lib/validated_object/version.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a4dc2f4ddb469aa576852bcaf36c911fdd948c7004587845addd89b942a1e2
|
4
|
+
data.tar.gz: 553d9e9974c1e3b833f5a8501e5fea4ecea54d8bb9188403a316fbea3b13f49f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0c33890be210b01c5b412795265c6c2babe78ab09f8f9743185b5134f659be85d42ff755428f73097cd0cd699fa8cb026311810fbf8ece289a7548e3e22081
|
7
|
+
data.tar.gz: 36dd56f3e89c9911ffa7984f97ce3c0966f879e331f5b6141a3773948598e8eae712f0a6fbb5df9fadf9fc481176cb18a2f1537a93ba64f73cfd11070b3716dc
|
data/lib/validated_object.rb
CHANGED
@@ -59,7 +59,7 @@ module ValidatedObject
|
|
59
59
|
|
60
60
|
set_instance_variables from_hash: attributes
|
61
61
|
check_validations!
|
62
|
-
self
|
62
|
+
return self
|
63
63
|
end
|
64
64
|
|
65
65
|
# Run any validations and raise an error if invalid.
|
@@ -112,13 +112,16 @@ module ValidatedObject
|
|
112
112
|
end
|
113
113
|
|
114
114
|
|
115
|
-
private
|
116
|
-
|
115
|
+
private
|
116
|
+
|
117
117
|
def set_instance_variables(from_hash:)
|
118
118
|
from_hash.each do |variable_name, variable_value|
|
119
|
+
# Test for the attribute reader
|
120
|
+
self.send variable_name.to_sym
|
121
|
+
|
122
|
+
# Set value in a way that succeeds even if attr is read-only
|
119
123
|
self.instance_variable_set "@#{variable_name}".to_sym, variable_value
|
120
124
|
end
|
121
125
|
end
|
122
|
-
|
123
126
|
end
|
124
127
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validated_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.7.
|
111
|
+
rubygems_version: 2.7.5
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Self-validating plain Ruby objects.
|