-
-
Save Goles/cce1ff6bf5cca01ccf5d to your computer and use it in GitHub Desktop.
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
# checking what's in the email subject | |
emails.each { |m| puts m.subject } | |
# outputs | |
Propuesta Ganadora! | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Propuesta perdida | |
Pago | |
Concurso finalizado! | |
# If I try to delete all the emails with the subject containing the word 'perdida' | |
counter = emails.delete_if { |m| m.subject.include? ('perdida') }.count | |
counter.should eq 9 # Counter is equal to 3 | |
# If I negate my delete_if block I get the expected result | |
counter = emails.delete_if { |m| not m.subject.include? ('perdida') }.count | |
counter.should eq 9 # Counter is equal to 9 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment