класс Interrupt
Вызывается при получении сигнала прерывания, обычно потому, что пользователь нажал сочетание клавиш Control-C (на большинстве платформ POSIX). Таким образом, он является подклассом SignalException.
begin
puts "Press ctrl-C when you get bored"
loop {}
rescue Interrupt => e
puts "Note: You will typically use Signal.trap instead."
end
выводит:
Press ctrl-C when you get bored
затем ожидает прерывания с помощью Control-C и затем выводит:
Note: You will typically use Signal.trap instead.
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.