egov_utils 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a052f6930056ce190d309b98e658f4bc2dbca18786140b8ca3582106b1c9a924
4
- data.tar.gz: 89b57ca5ff1d3749911521dc561a9f048af35a29521eb9852da4748e12ce937d
3
+ metadata.gz: a4a3886729d570a5525494c5c4ac720c4b84a63ace576b0844651061adb14b50
4
+ data.tar.gz: 79f2d1e38ad215c1611dde7519771b3be8780b2900f4db7e7de44d42fb41986a
5
5
  SHA512:
6
- metadata.gz: 69030f399b8efd00aff8624ba7da682aa37653db0291aff53dd86b775789e264715ff439328f8175a59d04941301625d75bf9e848e284be3e98797e396f6c361
7
- data.tar.gz: ae7e31c7fe5f2512b5bcc230448f12618b51281bc139770eff5538a28c4dfc5ae6b86d21be56b0f5261e72dc61b697687e43fb08a6d718482281eb508e1c13b0
6
+ metadata.gz: 22670485189a5a46bde82f39322b71e8d18ae2222f8b369d15f5b0faf180c8139c0e94f8b0c86696b2a6b5318feea87dd58a7c10c854dd34de707da56de7cc7d
7
+ data.tar.gz: 4e286f208dcc5093c6c219483337c82997bf9646f3da4d0f37489aab590878c42e57aa460eeab65f50155e20bc2a77da202a612542601717a3d737b768cb4839
@@ -1,5 +1,8 @@
1
1
  module EgovUtils
2
2
  class LegalPerson < AbstractPerson
3
+ before_validation :strip_spaces_from_ico
4
+
5
+ validates :ico, length: { is: 8 }
3
6
 
4
7
  belongs_to :person, class_name: 'EgovUtils::Person'
5
8
 
@@ -11,5 +14,10 @@ module EgovUtils
11
14
  "#{fullname} (#{ico})"
12
15
  end
13
16
 
17
+ private
18
+
19
+ def strip_spaces_from_ico
20
+ self.ico = ico.to_s.gsub(/\s+/, '') if ico.present?
21
+ end
14
22
  end
15
23
  end
@@ -1,6 +1,5 @@
1
1
  module EgovUtils
2
2
  class Person < ApplicationRecord
3
-
4
3
  # This is kept for accepts_nested_attributes_for compatibility, but
5
4
  # overloaded below.
6
5
  has_one :residence, class_name: 'EgovUtils::Address'
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.4.4'
2
+ VERSION = '1.4.5'
3
3
  end
@@ -25,5 +25,4 @@ FactoryBot.define do
25
25
  birth_date { Date.today - (Random.new.rand(50)+18).years }
26
26
  association :person, factory: :egov_utils_person
27
27
  end
28
-
29
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails