Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method · added in Ruby 3.3
Refinement#target
() -> ::Module?
target → class_or_module
eval.c
View on GitHub ↗
VALUE
rb_refinement_module_get_refined_class(VALUE module)
{
ID id_refined_class;
CONST_ID(id_refined_class, "__refined_class__");
return rb_attr_get(module, id_refined_class);
}
Return the class or module refined by the receiver.
Example
module M refine String do end end M.refinements[0].target # => String
Ruby version changes
-
3.3
-
Add
Refinement#targetas an alternative ofRefinement#refined_class.Refinement#refined_classis deprecated and will be removed in Ruby 3.4. [Feature #19714]
-