phonelib 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -163,7 +163,11 @@ module Phonelib
163
163
  # Gets matched number formating rule or default one
164
164
  def get_number_format(format_data)
165
165
  if format_data
166
- format_data.find { |f| /^#{f[:pattern]}$/ =~ @national_number }
166
+ format_data.find do |format|
167
+ (format[:leadingDigits].nil? \
168
+ || /^#{format[:leadingDigits]}/ =~ @national_number) \
169
+ && /^#{format[:pattern]}$/ =~ @national_number
170
+ end
167
171
  else
168
172
  Core::DEFAULT_NUMBER_FORMAT
169
173
  end
@@ -1,4 +1,4 @@
1
1
  module Phonelib
2
2
  # :nodoc:
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
@@ -51,7 +51,7 @@ namespace :phonelib do
51
51
 
52
52
  format.children.each do |f|
53
53
  if f.name != 'text'
54
- current_format[f.name.to_sym] = f.children.first.to_s.tr(" \n", "")
54
+ current_format[f.name.to_sym] = f.children.first.to_s.gsub(/\n\s+/, "")
55
55
  end
56
56
  end
57
57
 
Binary file
Binary file
@@ -1,19 +1,31 @@
1
1
  Connecting to database specified by database.yml
2
-  (0.9ms) select sqlite_version(*)
3
-  (6.8ms) CREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "possible_number" varchar(255))
4
-  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
5
-  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
-  (0.1ms) SELECT version FROM "schema_migrations"
7
-  (3.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20130122075331')
8
-  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20130121173847')
9
-  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
2
+  (0.1ms) select sqlite_version(*)
3
+  (7.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4
+  (2.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
6
+ Migrating to CreatePhones (20130121173847)
7
+  (0.1ms) begin transaction
8
+  (0.8ms) CREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9
+  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130121173847')
10
+  (4.1ms) commit transaction
11
+ Migrating to AddPossibleNumberToPhone (20130122075331)
12
+  (0.1ms) begin transaction
13
+  (0.6ms) ALTER TABLE "phones" ADD "possible_number" varchar(255)
14
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130122075331')
15
+  (2.7ms) commit transaction
16
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
10
17
  Connecting to database specified by database.yml
11
-  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
12
-  (0.1ms) select sqlite_version(*)
13
-  (3.7ms) CREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "possible_number" varchar(255)) 
14
-  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
15
-  (1.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16
-  (0.1ms) SELECT version FROM "schema_migrations"
17
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20130122075331')
18
-  (4.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20130121173847')
18
+  (0.7ms) select sqlite_version(*)
19
+  (5.1ms) DROP TABLE "phones"
20
+  (3.3ms) CREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "possible_number" varchar(255)) 
21
+  (0.2ms) SELECT version FROM "schema_migrations"
22
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
19
23
  Connecting to database specified by database.yml
24
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
25
+  (0.3ms) select sqlite_version(*)
26
+  (5.1ms) CREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "possible_number" varchar(255)) 
27
+  (2.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
28
+  (3.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
29
+  (0.1ms) SELECT version FROM "schema_migrations"
30
+  (2.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20130122075331')
31
+  (3.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20130121173847')