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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ead35b1f631106e09d5ed245b18ced301b0fd22a642136d2198dc65f592feb72
4
- data.tar.gz: 119b6594bedc0b63a11256ae7e40dccf67561cab4acccf6a67b7c3a08789642d
3
+ metadata.gz: a9a4dc2f4ddb469aa576852bcaf36c911fdd948c7004587845addd89b942a1e2
4
+ data.tar.gz: 553d9e9974c1e3b833f5a8501e5fea4ecea54d8bb9188403a316fbea3b13f49f
5
5
  SHA512:
6
- metadata.gz: 371f7b30919720b846b2d0a8f1b065e011da484632f889cf98b21847f34b41d1b4ed0bf213662f6876bdbbd088faede79e054ed83284cc9d589bdc8dd4fc52a3
7
- data.tar.gz: 8c9c3ea80f2924d23bd9297852b557f373a4bdcdb26785ef279730dbec5d3c372740be475f36652ece87884e6ec92bae13a5ea7b488e032ba684fdb29354ee09
6
+ metadata.gz: 7c0c33890be210b01c5b412795265c6c2babe78ab09f8f9743185b5134f659be85d42ff755428f73097cd0cd699fa8cb026311810fbf8ece289a7548e3e22081
7
+ data.tar.gz: 36dd56f3e89c9911ffa7984f97ce3c0966f879e331f5b6141a3773948598e8eae712f0a6fbb5df9fadf9fc481176cb18a2f1537a93ba64f73cfd11070b3716dc
@@ -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
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module ValidatedObject
3
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
4
5
  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.1
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-02-28 00:00:00.000000000 Z
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.6
111
+ rubygems_version: 2.7.5
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Self-validating plain Ruby objects.