msisdn-za 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,7 +1,21 @@
1
- log/*
2
- =======
1
+ ## MAC OS
3
2
  .DS_Store
4
- pkg/*
5
- pkg/**/*
6
- *.gem
7
3
 
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/craigp/msisdn-za"
12
12
  gem.authors = ["Craig Paterson"]
13
13
  gem.add_development_dependency "shoulda", ">= 2.11.1"
14
- gem.version = File.exist?('VERSION') ? File.read('VERSION') : ""
14
+ # gem.version = File.exist?('VERSION') ? File.read('VERSION') : ""
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/msisdn.rb CHANGED
@@ -1,9 +1,5 @@
1
1
  $:.unshift(File.dirname(__FILE__))
2
2
 
3
- module Msisdn
4
- VERSION = File.exist?('VERSION') ? File.read('VERSION') : ""
5
- end
6
-
7
3
  class Msisdn
8
4
  attr_accessor :original, :national_number, :dialing_code,
9
5
  :country_code, :local_dialing_code
@@ -34,27 +30,27 @@ class Msisdn
34
30
  def international
35
31
  "27#{@local_dialing_code.gsub(/^0+/, '')}#{@national_number}"
36
32
  end
37
-
33
+
38
34
  def international_with_prefix
39
35
  "+#{international}"
40
36
  end
41
-
37
+
42
38
  def valid?
43
39
  valid_national? && valid_local_dialing_code?
44
40
  end
45
-
41
+
46
42
  # a national number is valid if it has 7 digits and doesn't start with zeroes
47
43
  def valid_national?
48
44
  @national_number =~ /^\d{7}$/ && @national_number !~ /^0/
49
45
  end
50
-
46
+
51
47
  # a valid local dialing code should be three digits long and start with a zero
52
48
  def valid_local_dialing_code?
53
49
  @local_dialing_code =~ /^[\d][^0]{2}$/
54
50
  end
55
-
51
+
56
52
  def to_s
57
53
  international
58
54
  end
59
-
60
- end
55
+
56
+ end
data/msisdn-za.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{msisdn-za}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Craig Paterson"]
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "lib/msisdn.rb",
27
27
  "msisdn-za.gemspec",
28
- "script/console",
29
28
  "test/helper.rb",
30
29
  "test/test_msisdn.rb"
31
30
  ]
data/test/test_msisdn.rb CHANGED
@@ -33,6 +33,8 @@ class TestMsisdn < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  should "be valid" do
36
+ puts "CLASS: #{@msisdn.class.name}"
37
+ puts "DIAL CODE: #{@msisdn.local_dialing_code}"
36
38
  assert @msisdn.valid?
37
39
  end
38
40
 
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Craig Paterson
@@ -52,7 +52,6 @@ files:
52
52
  - VERSION
53
53
  - lib/msisdn.rb
54
54
  - msisdn-za.gemspec
55
- - script/console
56
55
  - test/helper.rb
57
56
  - test/test_msisdn.rb
58
57
  has_rdoc: true
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/msisdn.rb'}"
9
- puts "Loading msisdn gem"
10
- exec "#{irb} #{libs} --simple-prompt"