Skip to content

Commit

Permalink
Merge pull request mattsears#16 from BanzaiMan/jruby_compat
Browse files Browse the repository at this point in the history
JRuby compatibility
  • Loading branch information
mattsears committed Jan 14, 2012
2 parents ae57086 + 6c695c2 commit f63ec86
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/nyan_cat_formatter.rb
Expand Up @@ -81,11 +81,15 @@ def current_width
end

# A Unix trick using stty to get the console columns
# does not work in JRuby :-(
#
# @return [Fixnum]
def terminal_width
@terminal_width ||= `stty size`.split.map { |x| x.to_i }.reverse.first - 1
if defined? JRUBY_VERSION
default_width = 80
else
default_width = `stty size`.split.map { |x| x.to_i }.reverse.first - 1
end
@terminal_width ||= default_width
end

# Creates a data store of pass, failed, and pending example results
Expand Down

0 comments on commit f63ec86

Please sign in to comment.