Module: Remedy::Console::Resize
- Defined in:
- lib/remedy/console_resize.rb
Class Method Summary collapse
- .default_console_resized_hook! ⇒ Object
- .resized! ⇒ Object
- .resized? ⇒ Boolean
- .resizer? ⇒ Boolean
- .resizing! ⇒ Object
- .resizing? ⇒ Boolean
- .set_console_resized_hook! ⇒ Object
Class Method Details
.default_console_resized_hook! ⇒ Object
41 42 43 |
# File 'lib/remedy/console_resize.rb', line 41 def default_console_resized_hook! Signal.trap 'SIGWINCH', 'DEFAULT' end |
.resized! ⇒ Object
16 17 18 |
# File 'lib/remedy/console_resize.rb', line 16 def resized! @resize_count = @resize_count < 0 ? 0 : @resize_count - 1 end |
.resized? ⇒ Boolean
12 13 14 |
# File 'lib/remedy/console_resize.rb', line 12 def resized? @resize_count <= 1 end |
.resizer? ⇒ Boolean
20 21 22 |
# File 'lib/remedy/console_resize.rb', line 20 def resizer? @resize_count == 1 end |
.resizing! ⇒ Object
8 9 10 |
# File 'lib/remedy/console_resize.rb', line 8 def resizing! @resize_count = @resize_count < 1 ? 1 : @resize_count + 1 end |
.resizing? ⇒ Boolean
4 5 6 |
# File 'lib/remedy/console_resize.rb', line 4 def resizing? @resize_count > 0 end |
.set_console_resized_hook! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/remedy/console_resize.rb', line 24 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 |