Module: IRB::Pager::PagerHelper

Defined in:
lib/irb-pager.rb

Class Method Summary collapse

Class Method Details

.exception_formatter(exception) ⇒ Object



14
15
16
# File 'lib/irb-pager.rb', line 14

def self.exception_formatter exception
	["#{exception.class}: #{exception.message}", exception.backtrace.collect {|c| "\tfrom #{c}" }].join "\n"
end

.options(opts = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/irb-pager.rb', line 4

def self.options opts = nil
	opts = opts.kind_of?( Hash) ? opts.dup : {}
	stdout = opts[:stdout] || opts[:out]  || $stdout
	stderr = opts[:stderr] || opts[:err]  || $stderr
	stdin  = opts[:stdin]  || opts[:in]   || $stdin
	pager  = opts[:pager]  || opts[:less] || $PAGER || ENV['PAGER'] || 'less'
	rescuing = opts[:rescuing].nil? ? opts[:exceptions].nil? ? $PAGER_RESCUE : opts[:exceptions] : opts[:rescuing]
	[stdout, stderr, stdin, pager, rescuing]
end