Last active
September 7, 2019 16:16
-
-
Save sunny/8b99ee8fe243a069e2f1a19e61c16ec2 to your computer and use it in GitHub Desktop.
Adds #compact to Lazy Enumerators in Ruby
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
class Enumerator::Lazy | |
def compact | |
reject(&:nil?) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wrong, you should use
reject(&:nil?)
otherwise you rejectfalse
too.