validates_unchangeable 0.1.4 → 0.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: eb167db9e8fec2d392c95b590e35133500a4c7b86210dd7d78a6e1dcb6c55a9e
4
- data.tar.gz: 363827134b7ca97596577d6e3a41475b78b1b4b3786214ad248a2c56378284e7
3
+ metadata.gz: 8496a5c4702e11672fa9b58cfa0d93643fe2e59995961239a526a581b0956391
4
+ data.tar.gz: 73ef253d8302ac9f664785c63275db8fb734ef5f8cd219642a51a8fb03739b35
5
5
  SHA512:
6
- metadata.gz: ff1e8330b660abf8bf5f4e3211ae19bc43033c59750f2c6b48b0892739f22e579e2cc2a89caa6089e5ed01e56a3a04086616f4b01abec439f2db4d6c9e203da4
7
- data.tar.gz: 21b389811e7f2ee29676f8b37484aac8846ee10c6f2669200fb5354eb639a6ed550591df7b73fd1f45347ddce7e65772d64097c07c141bb2e752ed3885106b1e
6
+ metadata.gz: b552c960a02b9363d448db2d6e0e149e8825119b9c485c70f53b6c78d7e663fdd9e3b3aeb7c8f7a6770e60c39d2acbf2dcb80ac80b3ba830abb9f2f48322a060
7
+ data.tar.gz: 85d86ce254f63d2e2fa768ea499e2e0cb6cbf95f7104e0031b504488999be02c8016197aa1195f3dae52ede6305b7feea9b08cb0c93e91e7c61deeaae37143b0
data/Gemfile.lock CHANGED
@@ -1,74 +1,81 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validates_unchangeable (0.1.3)
5
- activemodel (>= 5.0, < 7.0)
4
+ validates_unchangeable (0.1.4)
5
+ activemodel (>= 5.0, < 7.1)
6
6
  i18n
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.0.3.4)
12
- activesupport (= 6.0.3.4)
13
- activerecord (6.0.3.4)
14
- activemodel (= 6.0.3.4)
15
- activesupport (= 6.0.3.4)
16
- activesupport (6.0.3.4)
11
+ activemodel (7.0.8)
12
+ activesupport (= 7.0.8)
13
+ activerecord (7.0.8)
14
+ activemodel (= 7.0.8)
15
+ activesupport (= 7.0.8)
16
+ activesupport (7.0.8)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
22
- ast (2.4.1)
23
- concurrent-ruby (1.1.7)
24
- diff-lcs (1.4.4)
25
- i18n (1.8.5)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ ast (2.4.2)
22
+ base64 (0.1.1)
23
+ concurrent-ruby (1.2.2)
24
+ diff-lcs (1.5.0)
25
+ i18n (1.14.1)
26
26
  concurrent-ruby (~> 1.0)
27
- minitest (5.14.2)
28
- parallel (1.19.2)
29
- parser (2.7.2.0)
27
+ json (2.6.3)
28
+ language_server-protocol (3.17.0.3)
29
+ mini_portile2 (2.8.5)
30
+ minitest (5.20.0)
31
+ parallel (1.23.0)
32
+ parser (3.2.2.4)
30
33
  ast (~> 2.4.1)
31
- rainbow (3.0.0)
34
+ racc
35
+ racc (1.7.1)
36
+ rainbow (3.1.1)
32
37
  rake (10.5.0)
33
- regexp_parser (1.8.1)
34
- rexml (3.2.4)
35
- rspec (3.9.0)
36
- rspec-core (~> 3.9.0)
37
- rspec-expectations (~> 3.9.0)
38
- rspec-mocks (~> 3.9.0)
39
- rspec-core (3.9.3)
40
- rspec-support (~> 3.9.3)
41
- rspec-expectations (3.9.2)
38
+ regexp_parser (2.8.2)
39
+ rexml (3.2.6)
40
+ rspec (3.12.0)
41
+ rspec-core (~> 3.12.0)
42
+ rspec-expectations (~> 3.12.0)
43
+ rspec-mocks (~> 3.12.0)
44
+ rspec-core (3.12.2)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-expectations (3.12.3)
42
47
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.9.0)
44
- rspec-mocks (3.9.1)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-mocks (3.12.6)
45
50
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.9.0)
47
- rspec-support (3.9.3)
48
- rubocop (0.93.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-support (3.12.1)
53
+ rubocop (1.57.1)
54
+ base64 (~> 0.1.1)
55
+ json (~> 2.3)
56
+ language_server-protocol (>= 3.17.0)
49
57
  parallel (~> 1.10)
50
- parser (>= 2.7.1.5)
58
+ parser (>= 3.2.2.4)
51
59
  rainbow (>= 2.2.2, < 4.0)
52
- regexp_parser (>= 1.8)
53
- rexml
54
- rubocop-ast (>= 0.6.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml (>= 3.2.5, < 4.0)
62
+ rubocop-ast (>= 1.28.1, < 2.0)
55
63
  ruby-progressbar (~> 1.7)
56
- unicode-display_width (>= 1.4.0, < 2.0)
57
- rubocop-ast (0.7.1)
58
- parser (>= 2.7.1.5)
59
- ruby-progressbar (1.10.1)
60
- sqlite3 (1.4.2)
61
- thread_safe (0.3.6)
62
- tzinfo (1.2.7)
63
- thread_safe (~> 0.1)
64
- unicode-display_width (1.7.0)
65
- zeitwerk (2.4.0)
64
+ unicode-display_width (>= 2.4.0, < 3.0)
65
+ rubocop-ast (1.29.0)
66
+ parser (>= 3.2.1.0)
67
+ ruby-progressbar (1.13.0)
68
+ sqlite3 (1.6.7)
69
+ mini_portile2 (~> 2.8.0)
70
+ tzinfo (2.0.6)
71
+ concurrent-ruby (~> 1.0)
72
+ unicode-display_width (2.5.0)
66
73
 
67
74
  PLATFORMS
68
75
  ruby
69
76
 
70
77
  DEPENDENCIES
71
- activerecord (>= 5.0, < 7.0)
78
+ activerecord (>= 5.0, < 7.1)
72
79
  bundler
73
80
  rake (~> 10.0)
74
81
  rspec (~> 3.0)
@@ -7,8 +7,7 @@ module ActiveModel
7
7
  class UnchangeableValidator < ActiveModel::EachValidator
8
8
  def validate_each(record, attribute, _value)
9
9
  if !record.public_send("#{attribute}_changed?") ||
10
- (record.public_send("#{attribute}_was") == default_value_for(record, attribute) &&
11
- !record.public_send(attribute).nil?)
10
+ (record.try(:new_record?) && !record.public_send(attribute).nil?)
12
11
  return
13
12
  end
14
13
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ValidatesUnchangeable
4
- VERSION = '0.1.4'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_unchangeable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vital Ryabchinskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-03 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.2.32
180
+ rubygems_version: 3.4.10
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Library for validating unchangeable attributes.