Sha256: be44496d7541b7d15c2e2803a2001c0fd740484868b633492223a0f779e5d6ca

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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://spreadsheets.google.com/pub?key=0AkCJNpm9Ks6JdE03elo4Q3ozRUlGTmhjU2NzTHA4bkE&hl=en&output=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

1 entries across 1 versions & 1 rubygems

Version Path
earth-0.3.5 lib/earth/rail/rail_class/data_miner.rb