add_regex returns inspected value for non Regexp objects. Workaround, so users don't have to care about enclosing values in double quotes.

This commit is contained in:
Timm 2013-07-31 16:14:00 +02:00
parent 3ac4c62622
commit a45ee9e5e3

@ -428,7 +428,8 @@ def initialize(substitute = '?')
end
def add_regex(regex)
return regex unless regex.is_a?(Regexp)
# Nokogiri doesn't like arbitrary values without quotes, hence inspect.
return regex.inspect unless regex.is_a?(Regexp)
@regexes.push(regex)
last_id.to_s # avoid implicit conversions of Fixnum to String
end