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
1 changed files with 3 additions and 1 deletions

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