class FrozenError
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
Public Class Methods
(?string? msg, ?receiver: T?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/errors.rbs, line 84
def initialize: (?string? msg, ?receiver: T?) -> void
Construct a new FrozenError exception. If given the receiver parameter may subsequently be examined using the FrozenError#receiver method.
a = [].freeze raise FrozenError.new("can't modify frozen array", receiver: a)
Public Instance Methods
() → T?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/errors.rbs, line 92
def receiver: () -> T?
Return the receiver associated with this FrozenError exception.