End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Method#owner
meth.owner → class_or_module
proc.c
View on GitHub ↗
static VALUE
method_owner(VALUE obj)
{
struct METHOD *data;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
return data->me->owner;
}
Returns the class or module that defines the method. See also Method#receiver.
Example
(1..3).method(:map).owner #=> Enumerable