Class: Datasets::HouseOfRepresentative

Inherits:
Dataset
  • Object
show all
Defined in:
lib/datasets/house-of-representative.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

#initializeHouseOfRepresentative

Returns a new instance of HouseOfRepresentative.



48
49
50
51
52
53
54
55
56
# File 'lib/datasets/house-of-representative.rb', line 48

def initialize
  super()

  @metadata.id = "house-of-representative"
  @metadata.name = "Bill of the House of Representatives of Japan"
  @metadata.url = "https://smartnews-smri.github.io/house-of-representatives"
  @metadata.licenses = ["MIT"]
  @metadata.description = "Bill of the House of Representatives of Japan"
end

Instance Method Details

#eachObject



58
59
60
61
62
63
64
65
66
67
# File 'lib/datasets/house-of-representative.rb', line 58

def each
  return to_enum(__method__) unless block_given?

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