Class: Pumi::DataSource::ISO31662

Inherits:
Object
  • Object
show all
Defined in:
lib/pumi/data_source/iso31662.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_file: Pumi::DataFile.new(:provinces)) ⇒ ISO31662

Returns a new instance of ISO31662.



6
7
8
# File 'lib/pumi/data_source/iso31662.rb', line 6

def initialize(data_file: Pumi::DataFile.new(:provinces))
  @data_file = data_file
end

Instance Attribute Details

#data_fileObject (readonly)

Returns the value of attribute data_file.



4
5
6
# File 'lib/pumi/data_source/iso31662.rb', line 4

def data_file
  @data_file
end

Instance Method Details

#load_data!(output_dir: "data") ⇒ Object



10
11
12
13
14
15
16
# File 'lib/pumi/data_source/iso31662.rb', line 10

def load_data!(output_dir: "data")
  data.each do |code, attributes|
    attributes["iso3166_2"] = "KH-#{code.to_i}"
  end

  write_data!(output_dir)
end