Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created September 11, 2014 15:48
Show Gist options
  • Save pumpkincouture/4c4f03325c6561a46119 to your computer and use it in GitHub Desktop.
Save pumpkincouture/4c4f03325c6561a46119 to your computer and use it in GitHub Desktop.
class Flight
attr_accessor :origin, :destination, :departure, :arrival, :price
def initialize(list)
@origin = list[0]
@destination = list[1]
@departure = list[2]
@arrival = list[3]
@price = list[4]
end
def no_lay_over
@origin == "A" && @destination == "Z"
end
def lay_over_one
@origin == "A" && @destination != "Z"
end
def lay_over_two
@origin != "A" && @destination != "Z"
end
def lay_over_three
@origin != "A" && @destination == "Z"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment