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

extracted is_a_dynamically_defined_method? from check_for_dynamically_defined_method

This commit is contained in:
John Mair 2011-04-26 03:19:55 +12:00
parent cc15c7622a
commit 4fc757ece1

View file

@ -56,9 +56,28 @@ class Pry
end
end
def check_for_dynamically_defined_method(meth)
def editor_with_start_line(line_number)
case Pry.editor
when /^[gm]?vi/, /^emacs/, /^nano/, /^pico/, /^gedit/, /^kate/
"#{Pry.editor} +#{line_number}"
when /^mate/
"#{Pry.editor} -l#{line_number}"
else
if RUBY_PLATFORM =~ /mswin|mingw/
Pry.editor
else
"#{Pry.editor} +#{line_number}"
end
end
end
def is_a_dynamically_defined_method?(meth)
file, _ = meth.source_location
if file =~ /(\(.*\))|<.*>/
!!(file =~ /(\(.*\))|<.*>/)
end
def check_for_dynamically_defined_method(meth)
if is_a_dynamically_defined_method?(meth)
raise "Cannot retrieve source for dynamically defined method."
end
end