really fix regex

bug/bundler_fix
Brent Cook 2016-05-23 20:08:38 -05:00
parent eb26202961
commit 76e8e8f6c7
1 changed files with 6 additions and 2 deletions

View File

@ -13,11 +13,15 @@ class OptRegexp < OptBase
end
def valid?(value, check_empty: true)
return false if check_empty && empty_required_value?(value)
if check_empty && empty_required_value?(value)
return false
elsif value.nil?
return true
end
begin
Regexp.compile(value)
return true
return super
rescue RegexpError, TypeError
return false
end