This is a multi-part message in MIME format.
------ extPart_000_0007_01BEA444.4F6B0E20
Content-Type: text/plain;
charset so-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi...
Can I call a function of a module from a class-method?
Following example didn't work! Why?
module A
def hello
print "HELLO\n"
end
end
class B
def call_A
include A # error
A.hello
end
end
x = B.new
x.call_A
Thanks...
Michael
------ extPart_000_0007_01BEA444.4F6B0E20
Content-Type: text/html;
charset so-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2014.210" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Can I call a function of a module from a
class-method?</FONT></DIV>
<DIV><FONT face=Arial size=2>Following example didn't work! Why?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>module A<BR> def
hello<BR> print "HELLO\n"<BR>
end<BR>end </FONT></DIV>
<DIV><FONT face=Arial size=2><BR>class B<BR> def
call_A<BR> include A #
error<BR> A.hello<BR>
end<BR>end</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>x = B.new<BR>x.call_A<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks...</FONT></DIV>
<DIV><FONT face=Arial size=2>Michael</FONT></DIV>
<DIV><FONT face=Arial size=2> </DIV></FONT></BODY></HTML>
------ extPart_000_0007_01BEA444.4F6B0E20--