Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cmeiklejohn
Created July 13, 2011 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmeiklejohn/1080724 to your computer and use it in GitHub Desktop.
Save cmeiklejohn/1080724 to your computer and use it in GitHub Desktop.
Array of regexp matching with include?
class Array
def include_by_regexp_or_string?(str)
any? do |o|
o.is_a?(Regexp) ? o =~ str : o == str
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment