class ISO3166P2::Regions
Attributes
all[R]
Public Class Methods
new()
click to toggle source
# File lib/ISO3166P2/regions.rb, line 5 def initialize init_regions end
Public Instance Methods
first()
click to toggle source
# File lib/ISO3166P2/regions.rb, line 13 def first @all.first end
size()
click to toggle source
# File lib/ISO3166P2/regions.rb, line 9 def size @all.size end
Private Instance Methods
init_regions()
click to toggle source
# File lib/ISO3166P2/regions.rb, line 19 def init_regions regions_hash = Parser.new.regional_data # Example tuple: {:country_short_code=>"ZW", :region_name=>"Midlands", :region_type=>"Province", # :regional_code=>"MI", :regional_number_code=>21281} @all = regions_hash.map do |region| Region.new region[:country_short_code], region[:region_name], region[:region_type], region[:regional_code], region[:regional_number_code] end end