Class: GlobalPhone::Territory

Inherits:
Record
  • Object
show all
Defined in:
lib/global_phone/territory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Record

field

Constructor Details

#initialize(data, region) ⇒ Territory

Returns a new instance of Territory.



19
20
21
22
# File 'lib/global_phone/territory.rb', line 19

def initialize(data, region)
  super(data)
  @region = region
end

Instance Attribute Details

#regionObject (readonly)

Returns the value of attribute region.



11
12
13
# File 'lib/global_phone/territory.rb', line 11

def region
  @region
end

Instance Method Details

#inspectObject



29
30
31
# File 'lib/global_phone/territory.rb', line 29

def inspect
  "#<#{self.class.name} country_code=#{country_code} name=#{name}>"
end

#parse_national_string(string) ⇒ Object



24
25
26
27
# File 'lib/global_phone/territory.rb', line 24

def parse_national_string(string)
  string = normalize(string)
  Number.new(self, string) if possible?(string)
end