validated_object 2.1.0 → 2.2.0

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: beeec5e7c798a88c65b4f5a492ce3e59505dacf6a0a1f8de4da90ca59c73f873
4
- data.tar.gz: 3c18ec02b076c71a020eaf7825fa2014321e09ee43a5490373698bfd8deb3c59
3
+ metadata.gz: 66bdc1ee048b6518b260908a2a48e8c4676c4350f99641a0da1c041fdc82a530
4
+ data.tar.gz: 27e9c03469ee86a4875fc9b99d8796055f12e48f7c627bbf410c7b43468c6022
5
5
  SHA512:
6
- metadata.gz: 279331de46a2f201ee2eafcb1633ab0ad3b428fa7651276e7754a4e06b6a740f1c473fd14e6296d428d74e3ee39c962bdbcc0e0ebaf6f7bbc7a7fdd393bc56c1
7
- data.tar.gz: afe9a3252da50c7bd028ebbfec81729e0ecf71e0c8c5ff1272d31e616593d41e031a87b11602cfb0337dac3c21d0abad1af024007757c3cab462df66c79fa163
6
+ metadata.gz: 667688231472cb2d893ac1235be71c97111831f8f8510164c5152e4d37d4bd99b994c4cb189a36f1feb4af5786d0200b14e74ba27e69b7be3e1929795419d2db
7
+ data.tar.gz: ed1589b44cf7c83d7424ce46b5b09cb1990331aee38bee239232ed2e71b49b32a0c65e2a3fc4ad909c44cd2df1e0b81ee9e65b3191f35621ec50e1be2b499f30
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- - 2.3.1
3
+ - 2.6.6
5
4
  - 2.7.1
6
5
  before_install: gem install bundler
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ValidatedObject
5
- VERSION = '2.1.0'
5
+ VERSION = '2.2.0'
6
6
  end
@@ -63,18 +63,18 @@ module ValidatedObject
63
63
  #
64
64
  # @raise [ArgumentError] if the object is not valid at the
65
65
  # end of initialization or `attributes` is not a Hash.
66
- sig { params(attributes: SymbolHash).returns(ValidatedObject::Base)}
66
+ sig { params(attributes: SymbolHash).void }
67
67
  def initialize(attributes = EMPTY_HASH)
68
68
  set_instance_variables from_hash: attributes
69
69
  check_validations!
70
- self
70
+ nil
71
71
  end
72
72
 
73
73
  # Run any validations and raise an error if invalid.
74
74
  #
75
75
  # @raise [ArgumentError] if any validations fail.
76
76
  # @return [ValidatedObject::Base] the receiver
77
- sig {returns(ValidatedObject::Base)}
77
+ sig { returns(ValidatedObject::Base) }
78
78
  def check_validations!
79
79
  raise ArgumentError, errors.full_messages.join('; ') if invalid?
80
80
 
@@ -118,17 +118,17 @@ module ValidatedObject
118
118
 
119
119
  private
120
120
 
121
- sig {params(expected_class: T.untyped, value: T.untyped).returns(T.untyped)}
121
+ sig { params(expected_class: T.untyped, value: T.untyped).returns(T.untyped) }
122
122
  def pseudo_boolean?(expected_class, value)
123
123
  expected_class == Boolean && boolean?(value)
124
124
  end
125
125
 
126
- sig {params(expected_class: T.untyped, value: T.untyped).returns(T.untyped)}
126
+ sig { params(expected_class: T.untyped, value: T.untyped).returns(T.untyped) }
127
127
  def expected_class?(expected_class, value)
128
128
  value.is_a?(expected_class)
129
129
  end
130
130
 
131
- sig {params(value: T.untyped).returns(T.untyped)}
131
+ sig { params(value: T.untyped).returns(T.untyped) }
132
132
  def boolean?(value)
133
133
  value.is_a?(TrueClass) || value.is_a?(FalseClass)
134
134
  end
@@ -150,7 +150,7 @@ module ValidatedObject
150
150
 
151
151
  private
152
152
 
153
- sig {params(from_hash: SymbolHash).void}
153
+ sig { params(from_hash: SymbolHash).void }
154
154
  def set_instance_variables(from_hash:)
155
155
  from_hash.each do |variable_name, variable_value|
156
156
  # Test for the attribute reader
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.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-04 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.1.4
142
+ rubygems_version: 3.4.6
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Self-validating plain Ruby objects.