Skip to content

Instantly share code, notes, and snippets.

Created August 19, 2015 01:15
Show Gist options
  • Save anonymous/c9639b8dc0b83e962112 to your computer and use it in GitHub Desktop.
Save anonymous/c9639b8dc0b83e962112 to your computer and use it in GitHub Desktop.
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