russian_phone 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,6 +63,7 @@ module RussianPhone
63
63
  def city
64
64
  @city ||= parse(:city)
65
65
  end
66
+ alias_method :area, :city
66
67
 
67
68
  def country
68
69
  @country ||= parse(:country)
@@ -92,17 +93,21 @@ module RussianPhone
92
93
  []
93
94
  end
94
95
  end
95
-
96
+
97
+ def formatted_area
98
+ area.nil? ? '' : "(#{area})"
99
+ end
100
+
96
101
  def formatted_subscriber
97
- format.join('-')
102
+ subscriber.nil? ? '' : format.join('-')
98
103
  end
99
104
 
100
105
  def full
101
106
  if valid?
102
107
  if free? && extra == ''
103
- "8-#{city}-#{formatted_subscriber}"
108
+ "8-#{area}-#{formatted_subscriber}"
104
109
  else
105
- "+#{country} (#{city}) #{formatted_subscriber}#{extra == '' ? '' : ' ' + extra}"
110
+ "+#{country} #{formatted_area} #{formatted_subscriber}#{extra == '' ? '' : ' ' + extra}"
106
111
  end
107
112
  else
108
113
  ''
@@ -110,15 +115,15 @@ module RussianPhone
110
115
  end
111
116
 
112
117
  def clean
113
- "#{country}#{city}#{subscriber}"
118
+ "#{country}#{area}#{subscriber}"
114
119
  end
115
120
 
116
121
  def cell?
117
- Codes.cell_codes.include?(city)
122
+ Codes.cell_codes.include?(area)
118
123
  end
119
124
 
120
125
  def free?
121
- city == '800'
126
+ area == '800'
122
127
  end
123
128
 
124
129
  # alias_method(:to_s, :full)
@@ -1,3 +1,3 @@
1
1
  module RussianPhone
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: russian_phone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: