Skip to content

Commit

Permalink
Pager: use the ::jruby? helper from BaseHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrylo committed Jan 30, 2013
1 parent 04b51fd commit 3455947
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/pry/pager.rb
Expand Up @@ -12,8 +12,11 @@ def self.page(text, pager = nil)
case pager
when nil
no_pager = !SystemPager.available?
is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
(is_jruby || no_pager) ? SimplePager.new(text).page : SystemPager.new(text).page
if no_pager || Pry::Helpers::BaseHelpers.jruby?
SimplePager.new(text).page
else
SystemPager.new(text).page
end
when :simple
SimplePager.new(text).page
when :system
Expand All @@ -37,7 +40,7 @@ def page
# The pager size minus the number of lines used by the simple pager info bar.
page_size = Pry::Pager.page_size - 3
text_array = @text.lines.to_a

text_array.each_slice(page_size) do |chunk|
puts chunk.join
break if chunk.size < page_size
Expand Down

0 comments on commit 3455947

Please sign in to comment.