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

whereami -m is gone in favor of context inference.

Ref #515.
This commit is contained in:
Rob Gleeson 2012-04-06 09:31:44 +01:00
parent d4de593f08
commit 37377c1c45

View file

@ -16,17 +16,15 @@ class Pry
Usage: whereami [OPTIONS]
BANNER
def options(opts)
opts.on :m, 'Show the source code of the current method in context.'
def setup
@method = Pry::Method.from_binding(target)
end
def process
method = Pry::Method.from_binding(target)
def process
if show_method?
file = method.source_file
start = method.source_range.begin
finish = method.source_range.end - 1
file = @method.source_file
start = @method.source_range.begin
finish = @method.source_range.end - 1
marker = binding.eval("__LINE__")
else
file = target.eval("__FILE__")
@ -47,7 +45,7 @@ class Pry
code = Pry::Code.from_file(file).around(start, finish)
end
desc = (method && method.name_with_owner) || ""
desc = (@method && @method.name_with_owner) || ""
if !code.empty?
output.puts "\n#{text.bold('From:')} #{file} @ line #{start}#{desc}:\n\n"
@ -59,7 +57,7 @@ class Pry
private
def show_method?
opts[:m]
@method && !@method.instance_of?(Pry::Method::Disowned)
end
def invalid_file?(file)