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

fixed spooner's bug where simple_pager was invoked as a class method on BaseHelpers and so didnt have access to output method; now explicitly passing in output object when invoked as class method

This commit is contained in:
John Mair 2011-08-09 00:35:22 +12:00
parent 48fe5ddb8d
commit 8082d41e93

View file

@ -2,6 +2,7 @@ class Pry
module Helpers
module BaseHelpers
module_function
def silence_warnings
@ -86,7 +87,7 @@ class Pry
end
# a simple pager for systems without `less`. A la windows.
def simple_pager(text)
def simple_pager(text, output=output())
text_array = text.lines.to_a
text_array.each_slice(page_size) do |chunk|
output.puts chunk.join
@ -109,12 +110,12 @@ class Pry
# FIXME! Another JRuby hack
if Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
simple_pager(text)
simple_pager(text, output)
else
lesspipe { |less| less.puts text }
end
rescue Errno::ENOENT
simple_pager(text)
simple_pager(text, output)
rescue Errno::EPIPE
end