Created
August 19, 2015 01:15
-
-
Save anonymous/c9639b8dc0b83e962112 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
responses = ["hi", "hey", "hello"] | |
lines = ["hi there", "whats up man", "how is it going?"] | |
# Method 1 | |
lines.each do |line| | |
responses.each to |response| | |
return true if /#{response}/ =~ line | |
end | |
end | |
# Method 2 | |
return true if responses.any?{ |response| lines.include?(response) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment