From d1222396e3891a258e8f3cb67bbc5cc6918e8101 Mon Sep 17 00:00:00 2001 From: John Mair Date: Thu, 20 Dec 2012 20:14:11 +0100 Subject: [PATCH] allow Pry::Command.source to properly extract source for commands defined in REPL --- lib/pry/command.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pry/command.rb b/lib/pry/command.rb index e25c64ba..486c28bd 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -55,7 +55,8 @@ class Pry end def source - strip_leading_whitespace(block.source) + file, line = block.source_location + strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line)) end def source_location