1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Fix CodeRay 1.0.0 compatbility

This commit is contained in:
Conrad Irwin 2011-11-26 22:48:11 -08:00
parent 0dbefe1b12
commit 96f2f555ce

View file

@ -379,7 +379,9 @@ class Pry
def method_name_from_first_line(first_ln)
return nil if first_ln.strip !~ /^def /
CodeRay.scan(first_ln, :ruby).each_cons(2) do |t1, t2|
tokens = CodeRay.scan(first_ln, :ruby)
tokens = tokens.tokens.each_slice(2) if tokens.respond_to?(:tokens)
tokens.each_cons(2) do |t1, t2|
if t2.last == :method || t2.last == :ident && t1 == [".", :operator]
return t2.first
end