Skip to content

Instantly share code, notes, and snippets.

@soulcutter
Created August 14, 2014 16:19
Show Gist options
  • Save soulcutter/8f0bf70db144c3b1110b to your computer and use it in GitHub Desktop.
Save soulcutter/8f0bf70db144c3b1110b to your computer and use it in GitHub Desktop.
chaining vs one block
tickets.select { |ticket| ticket.promo_code_to_use == promo_code }
.reject { |ticket| inventory_excludes.include?(ticket.ticket_inventory) }
.size
# vs
tickets.count do |ticket|
ticket.promo_code_to_use == promo_code &&
!inventory_excludes.include?(ticket.ticket_inventory)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment