Method: Datasets::Penguins#each

Defined in:
lib/datasets/penguins.rb

#each(&block) ⇒ Object



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