Sha256: bb9f6d8999fd1d468a126bf3146b14964e42fe2ccaf601e2e3079dc9c34afaa1

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

require 'active_record'
require 'falls_back_on'
require 'flight'
require 'sniff'

class FlightRecord < ActiveRecord::Base
  include Sniff::Emitter
  include BrighterPlanet::Flight
  set_table_name 'flight_records'

  belongs_to :origin_airport, :class_name => 'Airport'
  belongs_to :destination_airport, :class_name => 'Airport'
  belongs_to :distance_class, :class_name => 'FlightDistanceClass'
  belongs_to :fuel_type, :class_name => 'FlightFuelType'
  belongs_to :propulsion, :class_name => 'FlightPropulsion'
  belongs_to :aircraft_class
  belongs_to :aircraft
  belongs_to :seat_class, :class_name => 'FlightSeatClass'
  belongs_to :airline
  belongs_to :domesticity, :class_name => 'FlightDomesticity'
  
  falls_back_on :trips => 1.941, # http://www.bts.gov/publications/america_on_the_go/long_distance_transportation_patterns/html/table_07.html
                :emplanements_per_trip => 1.67,
                :distance_estimate => 2077.4455,
                :load_factor => lambda { FlightSegment.fallback.load_factor }

  class << self
    def research(key)
      case key
      when :route_inefficiency_factor
        1.07
      when :dogleg_factor
        1.25
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
flight-0.0.23 lib/test_support/flight_record.rb
flight-0.0.22 lib/test_support/flight_record.rb
flight-0.0.21 lib/test_support/flight_record.rb
flight-0.0.20 lib/test_support/flight_record.rb
flight-0.0.19 lib/test_support/flight_record.rb
flight-0.0.18 lib/test_support/flight_record.rb
flight-0.0.17 lib/test_support/flight_record.rb
flight-0.0.16 lib/test_support/flight_record.rb
flight-0.0.14 lib/test_support/flight_record.rb
flight-0.0.13 lib/test_support/flight_record.rb
flight-0.0.12 lib/test_support/flight_record.rb
flight-0.0.11 lib/test_support/flight_record.rb
flight-0.0.10 lib/test_support/flight_record.rb
flight-0.0.9 lib/test_support/flight_record.rb
flight-0.0.8 lib/test_support/flight_record.rb