Sha256: a16d1ba93f463bf328e87b2b55883fe2dadd2432495b46ab35bab1202672d084

Contents?: true

Size: 1.29 KB

Versions: 45

Compression:

Stored size: 1.29 KB

Contents

RailClass.class_eval do
  data_miner do
    schema Earth.database_options do
      string 'name'
      float  'distance'
      string 'distance_units'
      float  'passengers'
      float  'speed'
      string 'speed_units'
      float  'duration'
      string 'duration_units'
      float  'electricity_intensity'
      string 'electricity_intensity_units'
      float  'diesel_intensity'
      string 'diesel_intensity_units'
      string 'description'
    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 'distance', :from_units => :miles, :to_units => :kilometres
      store 'speed', :from_units => :miles, :to_units => :kilometres
      store 'duration'
      store 'passengers'
      store 'electricity_intensity', :field_name => 'electricity_per_vehicle_mile', :from_units => :miles, :to_units => :kilometres
      store 'diesel_intensity', :field_name => 'diesel_per_vehicle_mile', :from_units => :gallons_per_mile, :to_units => :litres_per_kilometre
    end
  end
end

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
earth-0.2.14 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.13 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.12 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.11 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.9 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.8 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.7 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.6 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.5 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.4 lib/earth/rail/rail_class/data_miner.rb
earth-ruby19-0.2.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.2 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.1 lib/earth/rail/rail_class/data_miner.rb
earth-0.2.0 lib/earth/rail/rail_class/data_miner.rb
earth-0.1.4 lib/earth/rail/rail_class/data_miner.rb
earth-0.1.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.1.2 lib/earth/rail/rail_class/data_miner.rb
earth-0.1.1 lib/earth/rail/rail_class/data_miner.rb
earth-0.1.0 lib/earth/rail/rail_class/data_miner.rb