Sha256: 46d0f9ab10856a5f3dcf9f2a71431bf442814bea6a327ce5d0752b498319458d
Contents?: true
Size: 742 Bytes
Versions: 5
Compression:
Stored size: 742 Bytes
Contents
module Remedy module ConsoleResized module_function def resizing? @resize_count > 0 end def resizing! @resize_count = @resize_count < 1 ? 1 : @resize_count + 1 end def resized? @resize_count <= 1 end def resized! @resize_count = @resize_count < 0 ? 0 : @resize_count - 1 end def resizer? @resize_count == 1 end def set_console_resized_hook! @resize_count = 0 command = lambda { |x| resizing! sleep 0.25 if resized? then yield end resized! } Signal.trap 'SIGWINCH', command end def default_console_resized_hook! Signal.trap 'SIGWINCH', 'DEFAULT' end end end
Version data entries
5 entries across 5 versions & 1 rubygems