What is the proper syntax for a method that checks a string for a pattern, and returns true or false if the regex matches?
Basic idea:
def has_regex?(str
For anyone's future reference, double bangs are frowned upon from bbatsov's ruby style guide. Instead of using a double bang, just check if the value isn't nil. If the value isn't nil, it exists.
Instead of doing this:
def has_regex?(string)
!!(string =~ /something/i)
end
You can always do this:
def has_regex?(string)
!(string =~ /something/i).nil?
end