Permalink
Browse files

Add reserved keyword to Phony DSL.

  • Loading branch information...
1 parent 5d824cc commit 9b4234a5024780f3b781b9a68e9c12104dea9c94 @floere committed Sep 13, 2014
Showing with 29 additions and 15 deletions.
  1. +4 −0 history.textile
  2. +8 −8 lib/phony/countries.rb
  3. +12 −6 lib/phony/dsl.rb
  4. +4 −0 lib/phony/national_splitters/dsl.rb
  5. +1 −1 phony.gemspec
View
@@ -1,3 +1,7 @@
+h2. Version 2.3.0
+
+* hanke: Introduces the reserved DSL. If reserved, any operation on a number fails.
+
h2. Version 2.2.16
* hanke: Fixes for Spain and Austria (Thanks, see #176, #177).
@@ -23,7 +23,7 @@
# Reserved.
#
- #country '0', fixed(1) >> split(10) # Reserved.
+ reserved '0'
# USA, Canada, etc.
#
@@ -878,11 +878,11 @@
country '872', todo # Inmarsat (Pacific Ocean)
country '873', todo # Inmarsat (Indian Ocean)
country '874', todo # Inmarsat (Atlantic Ocean-West)
- country '875', todo # Reserved - Maritime Mobile Service Applications
- country '876', todo # Reserved - Maritime Mobile Service Applications
- country '877', todo # Reserved - Maritime Mobile Service Applications
+ country '875', todo # Maritime Mobile Service Applications
+ country '876', todo # Maritime Mobile Service Applications
+ country '877', todo # Maritime Mobile Service Applications
country '878', todo # Universal Personal Telecommunication Service (UPT)
- country '879', todo # Reserved for national non-commercial purposes
+ reserved '879' # Reserved for national non-commercial purposes
# Bangladesh (People's Republic of)
# country '880' # see special file
@@ -896,7 +896,7 @@
# country '886' # Taiwan, see special file
country '887', todo # -
- country '888', todo # Reserved for future global service
+ reserved '888' # Reserved for future global service
country '889', todo # -
country '890', todo # -
@@ -982,7 +982,7 @@
# Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
country '968', fixed(2) >> split(3,3)
- country '969', todo # Reserved - reservation currently under investigation
+ reserved '969' # Reserved - reservation currently under investigation
country '970', # 970 is used in those countries that block access to 972 (Israel)
one_of('1') >> split(3,3,3) | # special numbers
@@ -1054,5 +1054,5 @@
country '997', todo # Spare code
country '998', fixed(2) >> split(3, 4) # Uzbekistan (Republic of) http://www.wtng.info/wtng-998-uz.html
- country '999', todo # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
+ reserved '999' # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
end
View
@@ -54,6 +54,18 @@ def country country_code, definition, options = {}
Phony::CountryCodes.instance.add country_code, definition
end
+ # Designates a country code as reserved.
+ #
+ def reserved country_code
+ # Does nothing, will just fail with an exception.
+ end
+
+ # This country still uses a default NDC (and needs to be done, hence the todo).
+ #
+ def todo
+ none >> split(10)
+ end
+
#
#
def trunk code, options = {}
@@ -131,12 +143,6 @@ def match regex, options = {}
NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
end
-
- # This country still uses a default NDC (and needs to be done, hence the todo).
- #
- def todo
- none >> split(10)
- end
# Local splitters.
#
@@ -21,6 +21,10 @@ def country_for local_splitter
Phony::Country.new Phony::NationalCode.new(self, local_splitter)
end
+ def reserved
+
+ end
+
end
end
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'phony'
- s.version = '2.2.16'
+ s.version = '2.3.0'
s.authors = ['Florian Hanke']
s.email = 'florian.hanke+phony@gmail.com'
s.homepage = 'http://github.com/floere/phony'

0 comments on commit 9b4234a

Please sign in to comment.