From: "Mauricio Fernández" Date: 2003-01-24T21:19:19+09:00 Subject: Re: how do you extend a class externally? On Fri, Jan 24, 2003 at 06:40:21PM +0900, Tom Sawyer wrote: > how do you extend a class externally? > > module B > ... > end > > class A > ... > end > > # ??? > A.include(B) include is private > A.extend(B) This works, but doesn't do what you want as it is performed on singleton level. > A.append_features(B) this is private too > A.class_eval { include B } This works, AFAIK. cpmf2196@l4 ~ $ ruby class A end module B def boo p "BOO" end end A.class_eval "include B" A.new.boo "BOO" > none of these work. > Is there a reason for Module (Class?, have no ri here)#include to be private? -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com #if _FP_W_TYPE_SIZE < 64 #error "Only stud muffins allowed, schmuck." #endif -- linux/arch/sparc64/quad.c