instance method
Module#extend_object
(untyped arg0) -> untyped
extend_object(obj) → obj
eval.c
View on GitHub ↗
static VALUE
rb_mod_extend_object(VALUE mod, VALUE obj)
{
rb_extend_object(obj, mod);
return obj;
}
Extends the specified object by adding this module’s constants and methods (which are added as singleton methods). This is the callback method used by Object#extend.
Example
module Picky def Picky.extend_object(o) if String === o puts "Can't add Picky to a String" else puts "Picky added to #{o.class}" super end end end (s = Array.new).extend Picky # Call Object.extend (s = "quick brown fox").extend Picky
produces:
Picky added to Array Can't add Picky to a String