msisdn-za 0.1.4 → 0.1.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.
- data/VERSION +1 -1
- data/lib/msisdn.rb +9 -3
- data/msisdn-za.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/msisdn.rb
CHANGED
@@ -22,23 +22,29 @@ class Msisdn
|
|
22
22
|
# so now the first three digits *should* be the local dialing code
|
23
23
|
@local_dialing_code, @national_number = $1, $2
|
24
24
|
|
25
|
-
#
|
25
|
+
# for compatibility with armanddp's gem
|
26
26
|
@dialing_code = @local_dialing_code
|
27
27
|
@country_code = default_country_code
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
|
+
# for compatibility with armanddp's gem
|
31
|
+
def international; international_number; end
|
32
|
+
|
30
33
|
def international_number
|
31
34
|
"27#{@local_dialing_code.gsub(/^0+/, '')}#{@national_number}"
|
32
35
|
end
|
33
36
|
|
34
37
|
def international_number_with_prefix
|
35
|
-
"+#{
|
38
|
+
"+#{international_number}"
|
36
39
|
end
|
37
40
|
|
38
41
|
def valid?
|
39
42
|
valid_national_number? && valid_local_dialing_code?
|
40
43
|
end
|
41
44
|
|
45
|
+
# for compatibility with armanddp's gem
|
46
|
+
def valid_national?; valid_national_number?; end
|
47
|
+
|
42
48
|
# a national number is valid if it has 7 digits and doesn't start with zeroes
|
43
49
|
def valid_national_number?
|
44
50
|
# removing the check for leading zero, since it is breaking things,
|
data/msisdn-za.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msisdn-za
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Craig Paterson
|