validation 0.2.0 → 0.2.1

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: 1d144d978b7a0e49977482c87f9d534ebb47e5c91d908add0b34a105be5c64f1
4
- data.tar.gz: fcf3649be5e675dff043e897f1a1d211d7d52b4fec5791fe7d1daf64d13b97da
3
+ metadata.gz: 308b38808d6f3bc696da17cf6f44df52835fb445ed3528ad0f8fe6953a1a3b38
4
+ data.tar.gz: d5402d26b469919fa3d4380144b4dd6b36d2e4ec20d9c8bcc0d2a77274785d1d
5
5
  SHA512:
6
- metadata.gz: 71d287e4cc2cdde74bc9f1be97485b930888c3dfadc84c87cc46345f9a108a59d1829fc1f45ffe8e5b23e06a4b7d3a803153c416c9f28583651f8d8a2ced99f4
7
- data.tar.gz: edf825b606995c91c8b713ba1e02ae978f35591dba626ecb4d30b34d3d2d063c2339b8f1782afe0d52fb36a24c2881138e902b071499a19f9deedf2e5b29bd48
6
+ metadata.gz: 572b349c534e226a170220448051db58b8a36a7a8110d096b5ece16a3b271c7bcfc88acdc666c18aab7c2d77e86d596834e6e47ca75a93711e74e906ba1be80a
7
+ data.tar.gz: ae4b447c75077f9a0bb297140b0985510decc69e31877633aaab532e9f950bf17130bf061dc76de750f8e070d16f457147d3ffdc0eb17f7d24106503b6be4404
data/README.md CHANGED
@@ -12,7 +12,7 @@ Require Ruby 2.5 or later
12
12
  Add below code into your Gemfile
13
13
 
14
14
  ```ruby
15
- gem 'validation', '>= 0.2.0', '< 0.3.0'
15
+ gem 'validation', '>= 0.2.1', '< 0.3.0'
16
16
  ```
17
17
 
18
18
  ### Overview
@@ -9,7 +9,12 @@ module Validation
9
9
  # @return [Symbol]
10
10
  def attr_reader_with_validation(name, condition)
11
11
  define_method(name) do
12
- value = instance_variable_get(:"@#{name}")
12
+ ivar = :"@#{name}"
13
+ unless instance_variable_defined?(ivar)
14
+ instance_variable_set(ivar, nil)
15
+ end
16
+
17
+ value = instance_variable_get(ivar)
13
18
 
14
19
  unless _valid?(condition, value)
15
20
  raise InvalidReadingError,
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Validation
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Kamiya
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  - !ruby/object:Gem::Version
267
267
  version: '0'
268
268
  requirements: []
269
- rubygems_version: 3.2.15
269
+ rubygems_version: 3.1.4
270
270
  signing_key:
271
271
  specification_version: 4
272
272
  summary: Validation in Ruby objects