Created
August 3, 2011 07:01
-
-
Save cchandler/1122063 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
INCLUSION = ["asdf"] | |
EXCLUSION = ["rofl"] | |
terms = ["asdfrofl", "asdf", "bbbb" ] # Only 1 valid term | |
results = terms.select {|s| INCLUSION.any?{|included| s.include? included} and not EXCLUSION.any?{ |excluded| s.include? excluded } } | |
p results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment