mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Merge pull request #881 from stuporglue/master
Escape method definition names before using in regexp
This commit is contained in:
commit
db15bddb1e
1 changed files with 2 additions and 2 deletions
|
@ -179,11 +179,11 @@ class Pry
|
|||
end
|
||||
|
||||
def singleton_method_definition?(name, definition_line)
|
||||
/^define_singleton_method\(?\s*[:\"\']#{name}|^def\s*self\.#{name}/ =~ definition_line.strip
|
||||
/^define_singleton_method\(?\s*[:\"\']#{Regexp.escape(name)}|^def\s*self\.#{Regexp.escape(name)}/ =~ definition_line.strip
|
||||
end
|
||||
|
||||
def instance_method_definition?(name, definition_line)
|
||||
/^define_method\(?\s*[:\"\']#{name}|^def\s*#{name}/ =~ definition_line.strip
|
||||
/^define_method\(?\s*[:\"\']#{Regexp.escape(name)}|^def\s*#{Regexp.escape(name)}/ =~ definition_line.strip
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue