[rspec-users] newbie cucumber tutorial
mark at mwilden.com
Wed Dec 24 10:25:16 EST 2008
On Wed, Dec 24, 2008 at 1:32 AM, Matt Wynne <matt at mattwynne.net> wrote:
> Is that some kind of trick to create multiple
> Not really in that particular case. Ruby modules generally allow you to do
> multiple inheritance by 'mixing in' behaviour to classes, but that would be
> when you use 'include' to bring the methods defined in the module into the
> class itself.
When you inherit from a class, you inherit both its instance methods and its
class methods. When you include a module, you (usually) just inherit its
instance methods. The trick under discussion just makes sure you inherit the
modules "class methods" as well, making it as if you inherited normally.
Is there any way without digging thru source to know which
> class include methods from other classes or do y'all just get so cozy
> with every Rails class you use that you "just know?"
ancestors tells you a class's superclasses (including modules).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users