module Remedy::Console::Resize
Public Instance Methods
default_console_resized_hook!()
click to toggle source
# File lib/remedy/console_resize.rb, line 44 def default_console_resized_hook! Signal.trap 'SIGWINCH', 'DEFAULT' end
resized!()
click to toggle source
# File lib/remedy/console_resize.rb, line 16 def resized! @resize_count = @resize_count < 0 ? 0 : @resize_count - 1 end
resized?()
click to toggle source
# File lib/remedy/console_resize.rb, line 12 def resized? @resize_count <= 1 end
resizer?()
click to toggle source
# File lib/remedy/console_resize.rb, line 20 def resizer? @resize_count == 1 end
resizing!()
click to toggle source
# File lib/remedy/console_resize.rb, line 8 def resizing! @resize_count = @resize_count < 1 ? 1 : @resize_count + 1 end
resizing?()
click to toggle source
# File lib/remedy/console_resize.rb, line 4 def resizing? @resize_count > 0 end
set_console_resized_hook!() { |size| ... }
click to toggle source
# File lib/remedy/console_resize.rb, line 24 def set_console_resized_hook! @resize_count = 0 Signal.trap 'SIGWINCH' do resizing! if resized? then begin yield Console.size rescue Exception => ex # Ruby will eat *any* errors inside a trap, # so we need to expose them for debuggability p ex end end resized! end end