Sha256: a475cff95c8edfafd02a45922958cf677464c7751833253ebe0cb5206bf02f9e

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

RailClass.class_eval do
  data_miner do
    schema Earth.database_options do
      string 'name'
      string 'description'
      float  'passengers'
      float  'distance'
      string 'distance_units'
      float  'speed'
      string 'speed_units'
      float  'electricity_intensity'
      string 'electricity_intensity_units'
      float  'diesel_intensity'
      string 'diesel_intensity_units'
    end
    
    process "Define some unit conversions" do
      Conversions.register :gallons_per_mile, :litres_per_kilometre, 2.35214583
    end

    import "a list of rail classes and pre-calculated trip and fuel use characteristics",
           :url => 'http://static.brighterplanet.com/science/data/transport/rail/rail_classes.csv' do
      key   'name'
      store 'description'
      store 'passengers'
      store 'distance', :units_field_name => 'distance_units'
      store 'speed', :units_field_name => 'speed_units'
      store 'electricity_intensity', :units_field_name => 'electricity_intensity_units'
      store 'diesel_intensity', :units_field_name => 'diesel_intensity_units'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.3.4 lib/earth/rail/rail_class/data_miner.rb
earth-0.3.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.3.2 lib/earth/rail/rail_class/data_miner.rb
earth-0.3.1 lib/earth/rail/rail_class/data_miner.rb
earth-0.3.0 lib/earth/rail/rail_class/data_miner.rb