-
-
Save soulcutter/8f0bf70db144c3b1110b to your computer and use it in GitHub Desktop.
chaining vs one block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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