big-phoney 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/big-phoney.gemspec +2 -1
- data/lib/big-phoney.rb +1 -0
- data/lib/big_phoney/string_extensions.rb +19 -0
- metadata +4 -3
data/big-phoney.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{big-phoney}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Pat Nakajima", "Brandon Keene"]
|
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
"lib/big-phoney.rb",
|
15
15
|
"lib/big_phoney.rb",
|
16
16
|
"lib/big_phoney/rails.rb",
|
17
|
+
"lib/big_phoney/string_extensions.rb",
|
17
18
|
"lib/big_phoney/phone_number.rb",
|
18
19
|
"lib/big_phoney/.gitignore",
|
19
20
|
"spec/big_phoney_spec.rb",
|
data/lib/big-phoney.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module BigPhoney
|
2
|
+
module StringExtensions
|
3
|
+
def to_phone_number(options={})
|
4
|
+
delimiter = options[:delimiter] || '-'
|
5
|
+
phone_number = BigPhoney::PhoneNumber.new(self)
|
6
|
+
area_code = phone_number.area_code
|
7
|
+
prefix = phone_number.prefix
|
8
|
+
rest = phone_number.rest
|
9
|
+
|
10
|
+
if options[:area_code]
|
11
|
+
"(#{area_code}) #{prefix + delimiter + rest}"
|
12
|
+
else
|
13
|
+
[area_code, prefix, rest].join(delimiter)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
String.send :include, BigPhoney::StringExtensions
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: big-phoney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Nakajima
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/big-phoney.rb
|
36
36
|
- lib/big_phoney.rb
|
37
37
|
- lib/big_phoney/rails.rb
|
38
|
+
- lib/big_phoney/string_extensions.rb
|
38
39
|
- lib/big_phoney/phone_number.rb
|
39
40
|
- lib/big_phoney/.gitignore
|
40
41
|
- spec/big_phoney_spec.rb
|