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

fixed suppression of exceptions by ';'

This commit is contained in:
John Mair 2011-04-11 11:10:05 +12:00
parent dbe7733967
commit d95e787dac

View file

@ -143,7 +143,7 @@ class Pry
target = Pry.binding_for(target)
result = re(target)
print.call output, result if !@suppress_output
print.call output, result if should_print?(result)
end
# Perform a read-eval
@ -284,6 +284,15 @@ class Pry
end
end
# Whether the print proc should be invoked.
# Currently only invoked if the output is not suppressed OR the output
# is an exception regardless of suppression.
# @param [Object] result The result of evaluation stage of the REPL
# @return [Boolean] Whether the print proc should be invoked.
def should_print?(result)
!@suppress_output || result.is_a?(Exception)
end
# Returns the appropriate prompt to use.
# This method should not need to be invoked directly.
# @param [Boolean] first_line Whether this is the first line of input