From: Ricky Ng Date: 2013-01-19T04:13:37+09:00 Subject: Re: Module including other module. --e0cb4efe2ea61ea3f604d394d0d1 Content-Type: text/plain; charset=ISO-8859-1 I've updated the gist a bit to reflect what you found about moving the class decoration below the module A reopening. This is just really baffling =( For a concrete example, if I wrote an extension module SuperEnum to Enumerable and wanted all objects that included Enumerable to have access to this extension, I would expect that I could open up the module Enumerable and include module SuperEnum. On Fri, Jan 18, 2013 at 5:35 AM, jake kaiden wrote: > hmmm... > > not sure what's going on there, i'd expect the same behavior that you > do. you've probably already found ways to work around this, but if not, > both of these work: > > module A > def foo1; end > end > > module B > def foo2; end > end > > module A > include B > def foo3; end > end > > class Klass > include A > end > > p Klass.instance_methods > > **** or **** > > module A > def foo1; end > end > > class Klass > include A > end > > module B > def foo2; end > end > > class Klass > include B > end > > module A > def foo3; end > end > > p Klass.instance_methods > > wish i could explain (and understand!) why your original example > doesn't work as expected... > > - j > > -- > Posted via http://www.ruby-forum.com/. > > -- Incoherently, Ricky Ng --e0cb4efe2ea61ea3f604d394d0d1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I've updated the gist a bit to reflect what you found = about moving the class=A0decoration=A0below the module A reopening.=A0
=
This is just really baffling =3D(=A0
<= br>
For a concrete example, if I wrote an extension module SuperEnum= to Enumerable and wanted all objects that included Enumerable to have acce= ss to this extension, I would expect that I could open up the module Enumer= able and include module SuperEnum.


On Fri,= Jan 18, 2013 at 5:35 AM, jake kaiden <lists@ruby-forum.com> wrote:
hmmm...

=A0 not sure what's going on there, i'd expect the same behavior th= at you
do. =A0you've probably already found ways to work around this, but if n= ot,
both of these work:

module A
=A0 def foo1; end
end

module B
=A0 def foo2; end
end

module A
=A0 include B
=A0 def foo3; end
end

class Klass
=A0 include A
end

p Klass.instance_methods

**** or ****

module A
=A0 def foo1; end
end

class Klass
=A0 include A
end

module B
=A0 def foo2; end
end

class Klass
=A0 include B
end

module A
=A0 def foo3; end
end

p Klass.instance_methods

=A0 wish i could explain (and understand!) why your original example
doesn't work as expected...

=A0- j

--
Posted via http://= www.ruby-forum.com/.




-- Incoherently,
Ricky Ng
--e0cb4efe2ea61ea3f604d394d0d1--