From: William Herry Date: 2012-08-04T11:09:31+09:00 Subject: Re: Why does it fail? def Module1::Module2.hello --20cf307f34ba7ad65c04c66722d8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I know one way to define module method module Module1::Module2 def self.hello puts 'HELLO' end end On Fri, Aug 3, 2012 at 11:13 PM, I=C3=B1aki Baz Castillo wr= ote: > Hi, the following code fails: > > > module Module1 > module Module2 > end > end > > def Module1::Module2.hello > puts "HELLO" > end > > syntax error, unexpected keyword_end, expecting $end > > > But I can do: > > def Module1.hello > puts "HELLO" > end > > > why does the former fail? Any trink? > > Thanks a lot. > > -- > I=C3=B1aki Baz Castillo > > > --=20 William Herry =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D WilliamHerryChina@Gmail.com --20cf307f34ba7ad65c04c66722d8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I know one w= ay to define module method

module Module1::Module2
=C2=A0 def sel= f.hello
=C2=A0=C2=A0=C2=A0 puts 'HELLO'
=C2=A0 end
end
=

On Fri, Aug 3, 2012 at 11:13 PM, I=C3=B1aki Baz Castillo = <ibc@aliax.net>= ; wrote:
Hi, the following code fails:


module Module1
=C2=A0 module Module2
=C2=A0 end
end

def Module1::Module2.hello
=C2=A0 puts "HELLO"
end

syntax error, unexpected keyword_end, expecting $end


But I can do:

def Module1.hello
=C2=A0 puts "HELLO"
end


why does the former fail? Any trink?

Thanks a lot.

--
I=C3=B1aki Baz Castillo
<ibc@aliax.net>




--


William Herry

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

WilliamHerryC= hina@Gmail.com

--20cf307f34ba7ad65c04c66722d8--