Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created March 16, 2011 20:12
Show Gist options
  • Select an option

  • Save practicingruby/873218 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/873218 to your computer and use it in GitHub Desktop.
def distance_to_hotel(day, index)
case
when index >= @grid.size - 1
''
when day[:lodgings].empty?
UNKNOWN_DISTANCE
when overnight_transport?(day)
OVERNIGHT_TRANSPORT_LABEL
when day[:arrive]
day[:arrive].distance_from(hotel_location(day)
else
UNKNOWN_DISTANCE
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment