DEV Community

Discussion on: correct horse battery staple

Collapse
 
baweaver profile image
Brandon Weaver

Fun fact: The XKCD site was hacked, and the second most common password used was "correct horse battery staple"

You can also use grep for === responding objects like Regexp:

@safe ||= words.grep(SAFE_SET)

grep_v will do the inverse (because grep -v in Unix). As of Ruby 2.5 (iirc) the predicate methods (any?, all?, none?, one?) also take === responding objects directly.