E
Eustaquio Rangel de Oliveira Jr.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi.
When I do
- -----------------------------------------------------------------------=
----
class Foo
~ def bar
~ puts "bar!"
~ end
end
- -----------------------------------------------------------------------=
----
and then
- -----------------------------------------------------------------------=
----
class Foo
~ def another_bar
~ puts "another bar!"
~ end
end
- -----------------------------------------------------------------------=
----
am I adding another_bar method to the Foo class instance or on it's metac=
lass?
I was reading
http://www.rubygarden.org/ruby?GavinSinclair/MetaClassDiscussion
"Ruby classes are themselves objects, being instances of the metaclass
~ Class. . . . The class Object is at the root of the hierarchy. . . .
~ Object itself is the only object without a superclass."
and then
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/40537
where Matz says that
">I've been trying to understand metaclasses
You don't have to, because there's no such a thing in Ruby."
and
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/40548
where Matz call them as meta-objects.
So, seems that there is some meta(class|object) around there (specially i=
f
you think about the graph here
http://www.rubygarden.org/ruby?ClassInstanceVariables, where explain the
class methods), but I'm curious of when adding a new method as described
above, where it is added, on the metaclass or on the class instance, to
reflect the new method on all current and future instances of Foo.
Thanks!
- ----------------------------
Eust=E1quio "TaQ" Rangel
(e-mail address removed)
http://beam.to/taq
Usu=E1rio GNU/Linux no. 224050
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)
iD8DBQFCyV2Wb6UiZnhJiLsRAoQxAJ43dBExQqvejAkYhPDhKNxLWeIBkwCfaEiB
IW2O52Q3+r7EMd7hg1Mbrc4=3D
=3DtSqS
-----END PGP SIGNATURE-----
Hash: SHA1
Hi.
When I do
- -----------------------------------------------------------------------=
----
class Foo
~ def bar
~ puts "bar!"
~ end
end
- -----------------------------------------------------------------------=
----
and then
- -----------------------------------------------------------------------=
----
class Foo
~ def another_bar
~ puts "another bar!"
~ end
end
- -----------------------------------------------------------------------=
----
am I adding another_bar method to the Foo class instance or on it's metac=
lass?
I was reading
http://www.rubygarden.org/ruby?GavinSinclair/MetaClassDiscussion
"Ruby classes are themselves objects, being instances of the metaclass
~ Class. . . . The class Object is at the root of the hierarchy. . . .
~ Object itself is the only object without a superclass."
and then
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/40537
where Matz says that
">I've been trying to understand metaclasses
You don't have to, because there's no such a thing in Ruby."
and
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/40548
where Matz call them as meta-objects.
So, seems that there is some meta(class|object) around there (specially i=
f
you think about the graph here
http://www.rubygarden.org/ruby?ClassInstanceVariables, where explain the
class methods), but I'm curious of when adding a new method as described
above, where it is added, on the metaclass or on the class instance, to
reflect the new method on all current and future instances of Foo.
Thanks!
- ----------------------------
Eust=E1quio "TaQ" Rangel
(e-mail address removed)
http://beam.to/taq
Usu=E1rio GNU/Linux no. 224050
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)
iD8DBQFCyV2Wb6UiZnhJiLsRAoQxAJ43dBExQqvejAkYhPDhKNxLWeIBkwCfaEiB
IW2O52Q3+r7EMd7hg1Mbrc4=3D
=3DtSqS
-----END PGP SIGNATURE-----