has_contact_number 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/has_contact_number/model_methods.rb +9 -3
- data/lib/has_contact_number/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d056ae179d5898609de13d5b73010177dbb06f2c3adea1947e308480d366334
|
4
|
+
data.tar.gz: 139f8bedf15eb4f3a5475c69094da19d9d283313dca38110fdd0ec60aefdf5f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d289a54bbce761715d0b8fbbb690cd206caa1162a30ce03102093e4792eb006c28f179047cd1f62049e976d5fcfac1e06888f3802a2233d4923bc4bfbccb3f8
|
7
|
+
data.tar.gz: e123155db191afc408839d81d6806058ae31b14d40cde2e4d4e1d1b70109335aecf78237c420977876defbd77c00d3687a5231156e7866a0b0fe896a93d09cf7
|
@@ -20,13 +20,19 @@ module HasContactNumber::ModelMethods
|
|
20
20
|
@#{column}_isd_code ||= #{column} && #{column}[0..3]
|
21
21
|
end
|
22
22
|
|
23
|
+
def #{column}_isd_code=(val)
|
24
|
+
@#{column}_isd_code = val
|
25
|
+
self.#{column} = "\#{val}\#{#{column}_without_isd_code}"
|
26
|
+
end
|
27
|
+
|
23
28
|
def #{column}_without_isd_code
|
24
29
|
@#{column}_without_isd_code ||= #{column} && #{column}[4..-1]
|
25
30
|
end
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
def #{column}_without_isd_code=(val)
|
33
|
+
@#{column}_without_isd_code = val
|
34
|
+
self.#{column} = "\#{#{column}_isd_code}\#{val}"
|
35
|
+
end
|
30
36
|
|
31
37
|
validates :#{column}_isd_code, presence: true, if: proc { |model| model.#{column}_without_isd_code.present? }
|
32
38
|
validates :#{column}_without_isd_code, presence: true, if: proc { |model| model.#{column}_isd_code.present? }
|