phone_wrangler 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
@@ -23,15 +23,11 @@ module PhoneWrangler
23
23
 
24
24
  #-------------------args-----------------------------------------
25
25
  def initialize(args='')
26
- @raw = args
27
- self.[] args
26
+ @original = args
27
+ self.raw = args
28
28
  end
29
29
 
30
- def set(args)
31
- self.[] args
32
- end
33
-
34
- def [] (args)
30
+ def raw= (args)
35
31
  case args
36
32
  when String
37
33
  parse_from_string(args)
@@ -67,15 +63,15 @@ module PhoneWrangler
67
63
  if format.nil?
68
64
  format = ''
69
65
  format += "(%a) " unless area_code.nil? or area_code.empty?
70
- format += "%p-" unless prefix.nil? or area_code.empty?
71
- format += "%n" unless number.nil? or area_code.empty?
72
- format += " x%e" unless extension.nil? or area_code.empty?
66
+ format += "%p-" unless prefix.nil? or prefix.empty?
67
+ format += "%n" unless number.nil? or number.empty?
68
+ format += " x%e" unless extension.nil? or extension.empty?
73
69
  end
74
70
  format_number(format)
75
71
  end
76
72
 
77
- def raw
78
- @raw
73
+ def original
74
+ @original
79
75
  end
80
76
 
81
77
  # TODO: Should #digits method include the extension digits at all? Probably not
@@ -174,12 +170,12 @@ end
174
170
  home = PhoneNumber.new('800/555-2468 x012')
175
171
  # or
176
172
  home = PhoneNumber.new
177
- home['800/555-2468 x012']
173
+ home.number = "256-777-7650"
178
174
  # or
179
175
  # home = PhoneNumber.new
180
176
  ({:area_code=>'800', :prefix=>'555', :number=>'2020'})
181
177
 
182
- puts home.raw
178
+ puts home.original
183
179
  puts home.area_code
184
180
  puts home.prefix
185
181
  puts home.number
@@ -0,0 +1,53 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{phone_wrangler}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ryan Waldron"]
12
+ s.date = %q{2010-01-13}
13
+ s.description = %q{Handle phone numbers intelligently}
14
+ s.email = %q{rew@erebor.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/phone_wrangler.rb",
27
+ "phone_wrangler.gemspec",
28
+ "test/phone_wrangler_test.rb",
29
+ "test/test_helper.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/erebor/phone_wrangler}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{Handle phone numbers intelligently}
36
+ s.test_files = [
37
+ "test/phone_wrangler_test.rb",
38
+ "test/test_helper.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
+ end
50
+ else
51
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
+ end
53
+ end
@@ -206,8 +206,8 @@ class PhoneWranglerTest < Test::Unit::TestCase
206
206
  end
207
207
 
208
208
 
209
- should "return raw data" do
210
- assert_equal @phone_hash, @pn.raw
209
+ should "return original data" do
210
+ assert_equal @phone_hash, @pn.original
211
211
  end
212
212
 
213
213
  should "provide a digits-only version" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phone_wrangler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Waldron
@@ -39,6 +39,7 @@ files:
39
39
  - Rakefile
40
40
  - VERSION
41
41
  - lib/phone_wrangler.rb
42
+ - phone_wrangler.gemspec
42
43
  - test/phone_wrangler_test.rb
43
44
  - test/test_helper.rb
44
45
  has_rdoc: true