класс 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–2025 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.