# File lib/pry/pry_instance.rb, line 379 def process_command(val, eval_string, target) result = commands.process_line(val, { :target => target, :output => output, :eval_string => eval_string, :pry_instance => self }) # set a temporary (just so we can inject the value we want into eval_string) Thread.current[:__pry_cmd_result__] = result # note that `result` wraps the result of command processing; if a # command was matched and invoked then `result.command?` returns true, # otherwise it returns false. if result.command? if !result.void_command? # the command that was invoked was non-void (had a return value) and so we make # the value of the current expression equal to the return value # of the command. eval_string.replace "Thread.current[:__pry_cmd_result__].retval\n" end true else false end end