Sha256: 32da1af9bb85329b3b9521d4d1f2150c97026abb7219c4ea34635f3fd4ec76e7

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

BreedGender.class_eval do
  data_miner do
    schema Earth.database_options do
      string   'name'
      string   'breed_name'
      string   'gender_name'
      float    'weight'
      string   'weight_units'
    end
    
    import "Brighter Planet's list of cat and dog breeds, genders, and weights",
           :url => 'http://static.brighterplanet.com/science/data/consumables/pets/breed_genders.csv',
           :encoding => 'ISO-8859-1',
           :select => lambda { |row| row['gender'].present? } do
      key 'name', :synthesize => lambda { |row| row['name'] + ' ' + row['gender'] }
      store 'breed_name', :field_name => 'name'
      store 'gender_name', :field_name => 'gender'
      store 'weight', :from_units => :pounds, :to_units => :kilograms
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.5.0 lib/earth/pet/breed_gender/data_miner.rb
earth-0.4.12 lib/earth/pet/breed_gender/data_miner.rb
earth-0.4.11 lib/earth/pet/breed_gender/data_miner.rb
earth-0.4.10 lib/earth/pet/breed_gender/data_miner.rb