提交 b8c6c084 编写于 作者: C Carlos Antonio da Silva

Cache regexp source on format validation to avoid allocating new objects

Example:

    >> r = /some-regexp/
    => /some-regexp/
    >> r.source.object_id == r.source.object_id
    => false
上级 70161ae3
......@@ -33,8 +33,8 @@ def record_error(record, attribute, name, value)
end
def regexp_using_multiline_anchors?(regexp)
regexp.source.start_with?("^") ||
(regexp.source.end_with?("$") && !regexp.source.end_with?("\\$"))
source = regexp.source
source.start_with?("^") || (source.end_with?("$") && !source.end_with?("\\$"))
end
def check_options_validity(options, name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册