Exception: Interrupt
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::SignalException ,
::Exception
|
|
Instance Chain:
self,
::SignalException ,
::Exception
|
|
Inherits: |
SignalException
|
Defined in: | error.c, error.c, signal.c |
Overview
Raised when the interrupt signal is received, typically because the user has pressed Control-C (on most posix platforms). As such, it is a subclass of ::SignalException
.
begin
puts "Press ctrl-C when you get bored"
loop {}
rescue Interrupt => e
puts "Note: You will typically use Signal.trap instead."
end
produces:
Press ctrl-C when you get bored
then waits until it is interrupted with Control-C and then prints:
Note: You will typically use Signal.trap instead.
Class Attribute Summary
::Exception
- Inherited
.to_tty? | Returns |
Class Method Summary
- .new(*args) constructor Internal use only
::SignalException
- Inherited
.new | Construct a new |
::Exception
- Inherited
.exception | Returns an exception object of the same class as |
.new | Returns a new exception object. |
Instance Method Summary
::SignalException
- Inherited
#signo | Returns a signal number. |
::Exception
- Inherited
#== | Returns whether |
#backtrace | Returns a backtrace value for |
#backtrace_locations | Returns a backtrace value for |
#cause | Returns the previous value of global variable |
#detailed_message | Returns the message string with enhancements: |
#exception | Returns an exception object of the same class as |
#full_message | Returns an enhanced message string: |
#inspect | Returns a string representation of |
#message | Returns |
#set_backtrace | Sets the backtrace value for |
#to_s | Returns a string representation of |
Constructor Details
.new(*args)
# File 'signal.c', line 395
static VALUE interrupt_init(int argc, VALUE *argv, VALUE self) { VALUE args[2]; args[0] = INT2FIX(SIGINT); args[1] = rb_check_arity(argc, 0, 1) ? argv[0] : Qnil; return rb_call_super(2, args); }