Method: Uncharted::Territory#initialize
- Defined in:
- lib/uncharted/territory.rb
#initialize(code, name, type) ⇒ Territory
Returns a new instance of Territory.
40 41 42 43 44 45 46 47 48 |
# File 'lib/uncharted/territory.rb', line 40 def initialize(code, name, type) @code = code @name = name @country_code, @abbr = code.split('-') @country = Country.find(@country_code) Territory.data[code] = self @country.subdivisions << self if @country @type = TYPES.detect {|t| /#{t}/ =~ type} || :territory end |