Skip to content

Instantly share code, notes, and snippets.

@rossmeissl
Created August 26, 2010 18:55
Show Gist options
  • Save rossmeissl/551968 to your computer and use it in GitHub Desktop.
Save rossmeissl/551968 to your computer and use it in GitHub Desktop.
TRAVEL_DISTANCE_INSIDE_ZIP_CODE = 7.89 #km
TRAVEL_DOGLEG_FACTOR = 1.259
TRAVEL_EMITTERS = {
:flight => 100..25000, # circumference of the earth
:rail_trip => 0..2500, # nyc -> la
:automobile => 0..2500,
:bus_trip => 0..2500
}
TRAVEL_WIZARD_CHARACTERISTIC_ORDER = {
:flight => [:origin_airport, :destination_airport, :emplanements_per_trip, :load_factor],
:automobile => [:make, :model_year, :model, :variant],
:bus_trip => [:bus_class],
:rail_trip => [:rail_class]
}
TRAVEL_WIZARD_DEFAULT_CHARACTERISTICS = {
:flight => { :trips => 2 },
:automobile => { :daily_distance_estimate => Proc.new { (@origin.eql?(@destination) ? TRAVEL_DISTANCE_INSIDE_ZIP_CODE : @origin.distance_to(@destination).miles.to(:kilometres)) * TRAVEL_DOGLEG_FACTOR } },
:bus_trip => { :distance_estimate => Proc.new { (@origin.eql?(@destination) ? TRAVEL_DISTANCE_INSIDE_ZIP_CODE : @origin.distance_to(@destination).miles.to(:kilometres)) * TRAVEL_DOGLEG_FACTOR * 2 } },
:rail_trip => { :distance_estimate => Proc.new { (@origin.eql?(@destination) ? TRAVEL_DISTANCE_INSIDE_ZIP_CODE : @origin.distance_to(@destination).miles.to(:kilometres)) * TRAVEL_DOGLEG_FACTOR * 2 } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment