lib/remedy/console.rb in remedy-0.2.0 vs lib/remedy/console.rb in remedy-0.3.0
- old
+ new
@@ -40,34 +40,34 @@
input.echo = true
input.cooked!
end
def columns
- size.last
+ size.cols
end
alias_method :width, :columns
def rows
- size.first
+ size.rows
end
alias_method :height, :rows
def size
str = [0, 0, 0, 0].pack('SSSS')
if input.ioctl(TIOCGWINSZ, str) >= 0 then
- str.unpack('SSSS').first 2
+ Size.new str.unpack('SSSS').first 2
else
raise UnknownConsoleSize, "Unable to get console size"
end
end
def interactive?
input.isatty
end
def set_console_resized_hook!
- Console::Resize.set_console_resized_hook! do
- yield
+ Console::Resize.set_console_resized_hook! do |*args|
+ yield *args
end
end
class UnknownConsoleSize < IOError; end
end