Class: Datasets::Penguins
Overview
This dataset provides the same dataset as https://github.com/allisonhorst/palmerpenguins
Defined Under Namespace
Classes: Record
Instance Attribute Summary
Attributes inherited from Dataset
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize ⇒ Penguins
constructor
A new instance of Penguins.
Methods inherited from Dataset
Constructor Details
permalink #initialize ⇒ Penguins
Returns a new instance of Penguins.
86 87 88 89 90 91 92 93 |
# File 'lib/datasets/penguins.rb', line 86 def initialize super @metadata.id = "palmerpenguins" @metadata.name = "palmerpenguins" @metadata.url = "https://allisonhorst.github.io/palmerpenguins/" @metadata.licenses = ["CC0"] @metadata.description = "A great dataset for data exploration & visualization, as an alternative to iris" end |
Instance Method Details
permalink #each(&block) ⇒ Object
[View source]
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/datasets/penguins.rb', line 95 def each(&block) return to_enum(__method__) unless block_given? species_classes = [ PenguinsRawData::Adelie, PenguinsRawData::Chinstrap, PenguinsRawData::Gentoo, ] species_classes.each do |species_class| species_class.new.each do |raw_record| yield convert_record(raw_record) end end end |