Class: Datasets::Geolonia

Inherits:
Dataset
  • Object
show all
Defined in:
lib/datasets/geolonia.rb

Defined Under Namespace

Classes: Record

Instance Attribute Summary

Attributes inherited from Dataset

#metadata

Instance Method Summary collapse

Methods inherited from Dataset

#clear_cache!, #to_table

Constructor Details

#initializeGeolonia

Returns a new instance of Geolonia.



22
23
24
25
26
27
28
29
30
31
# File 'lib/datasets/geolonia.rb', line 22

def initialize
  super
  @metadata.id = 'geolonia'
  @metadata.name = 'Geolonia'
  @metadata.url = 'https://github.com/geolonia/japanese-addresses'
  @metadata.licenses = ["CC-BY-4.0"]
  @metadata.description = lambda do
    fetch_readme
  end
end

Instance Method Details

#eachObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/datasets/geolonia.rb', line 33

def each
  return to_enum(__method__) unless block_given?

  open_data do |csv|
    csv.readline
    csv.each do |row|
      record = Record.new(*row)
      yield(record)
    end
  end
end