Class: Datasets::Wine
Defined Under Namespace
Classes: Record
Instance Attribute Summary
Attributes inherited from Dataset
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize ⇒ Wine
constructor
A new instance of Wine.
Methods inherited from Dataset
Constructor Details
#initialize ⇒ Wine
Returns a new instance of Wine.
22 23 24 25 26 27 28 29 |
# File 'lib/datasets/wine.rb', line 22 def initialize super .id = 'wine' .name = 'Wine' .url = 'https://archive.ics.uci.edu/ml/datasets/wine' .licenses = ["CC-BY-4.0"] .description = -> { read_names } end |
Instance Method Details
#each ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/datasets/wine.rb', line 31 def each return to_enum(__method__) unless block_given? open_data do |csv| csv.each do |row| next if row[0].nil? record = Record.new(*row) yield(record) end end end |