Skip to content

Instantly share code, notes, and snippets.

@efatsi
Created September 12, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save efatsi/3709460 to your computer and use it in GitHub Desktop.
Save efatsi/3709460 to your computer and use it in GitHub Desktop.
methodology comparison
def find_suggestions_for(restaurant)
past_orders = []
orders.each {|o| past_orders << o if o.restaurant == restaurant }
past_orders
end
def find_suggestions_for(restaurant)
orders.inject([]) do |result, order|
result << order if order.restaurant == restaurant
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment