Exception: FrozenError
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
RuntimeError
|
Defined in: | error.c, error.c |
Overview
Raised when there is an attempt to modify a frozen object.
[1, 2, 3].freeze << 4
raises the exception:
FrozenError: can't modify frozen Array
Class Attribute Summary
::Exception
- Inherited
.to_tty? | Returns |
Class Method Summary
-
.new(msg = nil, receiver: nil) ⇒ frozen_error
constructor
Construct a new
FrozenError
exception.
::Exception
- Inherited
.exception | Returns an exception object of the same class as |
.new | Returns a new exception object. |
Instance Method Summary
-
#receiver ⇒ Object
Return the receiver associated with this
FrozenError
exception.
::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(msg = nil, receiver: nil) ⇒ frozen_error
Construct a new FrozenError
exception. If given the receiver parameter may subsequently be examined using the #receiver method.
a = [].freeze
raise FrozenError.new("can't modify frozen array", receiver: a)
# File 'error.c', line 2190
static VALUE frozen_err_initialize(int argc, VALUE *argv, VALUE self) { ID keywords[1]; VALUE values[numberof(keywords)], options; argc = rb_scan_args(argc, argv, "*:", NULL, &options); keywords[0] = id_receiver; rb_get_kwargs(options, keywords, 0, numberof(values), values); rb_call_super(argc, argv); err_init_recv(self, values[0]); return self; }
Instance Method Details
#receiver ⇒ Object
Return the receiver associated with this FrozenError
exception.