Fix regexp in ruby-client (#1521)

* Fix regexp in ruby-client

* Remove tests for unknown regexp patterns
This commit is contained in:
meganemura
2018-11-28 17:40:58 +09:00
committed by William Cheng
parent 9b99b6b6bf
commit ebf67e683c
4 changed files with 7 additions and 41 deletions

View File

@@ -147,20 +147,7 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf
}
public String toRegularExpression(String pattern) {
if (StringUtils.isEmpty(pattern)) {
return pattern;
}
// We don't escape \ in string since Ruby doesn't like \ escaped in regex literal
String regexString = pattern;
if (!regexString.startsWith("/")) {
regexString = "/" + regexString;
}
if (StringUtils.countMatches(regexString, '/') == 1) {
// we only have forward slash inserted at start... adding one to end
regexString = regexString + "/";
}
return regexString;
return addRegularExpressionDelimiter(pattern);
}
@Override