Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Module#freeze
() -> self
mod.freeze → mod
object.c
View on GitHub ↗
static VALUE
rb_mod_freeze(VALUE mod)
{
// a permanent modification; already frozen changes no state, so stays a no-op
if (!OBJ_FROZEN(mod)) {
rb_class_owner_check(mod);
}
rb_class_name(mod);
return rb_obj_freeze(mod);
}
Prevents further modifications to mod.
This method returns self.