-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The method does not "win", they are chained after each other in the inherit=
ance chain.

Konstantin

On Apr 20, 2010, at 21:13 , Daniel Berger wrote:

> Hi,
>=20
> Ruby 1.8.7
> OSX 10.6.x
>=20
> It seems that when including multiple modules with identical method
> names there are different results when using multiple includes versus
> a single include with multiple arguments. In the the former case we
> get a "last method definition wins" but in the latter it's "first
> method definition wins".
>=20
> Is this expected behavior? If so, where is it documented?
>=20
> module X
>  def hello
>    puts "hello"
>  end
> end
>=20
> module Y
>  def hello
>    puts "greetings"
>  end
> end
>=20
> class Foo
>  include X
>  include Y
> end
>=20
> class Bar
>  include X, Y
> end
>=20
> Foo.new.hello # =3D> greetings
> Bar.new.hello # =3D> hello
>=20
> Regards,
>=20
> Dan
>=20

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iQEcBAEBAgAGBQJLzgmLAAoJEDb0VmU+GZ4ksXQIAKClsmU7C32mAaKOL+iYrgb6
HmjLUM9t1BYdI3MujXa49dpx9NbFZwBYYT6wWhrNQ9H7tvzFIUUxV1Zv8w09lXH9
KB7jsRNTet6OX8XRA1wgkYkvE0NmMgqOuR/zUtfMU0BF77romSDCH60YcsH/+Dwv
3E3uicwNE9o2XmZA87rq/4DcsTx2HeRT4MDVviFnfRK1Qh1UQHC8oLZsm0BjSJJG
SKGa36Tw5KcYA3cVW8CCZiwWDro3JeQ1csgCHJDdTUelbnpTBJdG0XlDyJ+ZvmE3
UjNLlDxoQFYjEBfiGOoWOp+XqlhmdZYuEtIzvMvToQy6kCsZBybxwitydLo7yhM=3D
=3DyCgs
-----END PGP SIGNATURE-----