[edit this] #1

Merged
merged 7 commits into from Jul 25, 2014

Projects

None yet

2 participants

@ryanzverner
Collaborator
  • Created cheapest and fastest flight calculator
  • Enter ruby start.rb on the command line to run
  • Creates output.txt. Right now only the answer to the first case is correct. The second case is more complicated so next I will modify all_paths.rb to get the correct paths for the more complicated flight cases.
@gitlaura
Owner
  • refactored all_paths.rb to eliminate duplicate among the methods that update the current path's attributes
  • refactored tests for multiple classes
  • removed "let" in rspec unless reused the variable multiple times
@ryanzverner ryanzverner commented on the diff Jul 24, 2014
lib/best_flights.rb
@@ -0,0 +1,30 @@
+class BestFlights
+ class << self
+ def get_cheapest_flight(all_flight_paths)
+ lowest_price = nil
+ all_flight_paths.each do |flight|
+ if lowest_price.nil? || flight.price < lowest_price
+ @best_flight = flight
@ryanzverner
ryanzverner Jul 24, 2014 Collaborator

Does @best_flight need to be an instance variable?

@ryanzverner ryanzverner merged commit eecfe2a into master Jul 25, 2014
@ryanzverner ryanzverner deleted the branch-to-merge branch Jul 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment