This seems less intuitive:
class Baz
def hello
"baz " + super
end
end
module Bar
def hello
"bar"
end
end
class Foo < Baz
def hello
"hello from " + super
end
include Bar
end
Foo.ancestors => [Foo, Bar, Baz, Object, Kernel, BasicObject]
Foo.new.hello => "hello from bar"
So super seems to traverse a stack of ancestors - there's no precedence
given to inheritance vs mixins (the implementation probably doesn't
discriminate).
On Tue, Dec 13, 2011 at 10:58 PM, Kunzmann <[email protected]> wrote:
> Seems including an extra module in the middle works some magic?
>
> This is what fails:
> https://gist.github.com/1471853
>
> On Dec 13, 9:59 pm, Andrew Grimm <[email protected]> wrote:
> > What was the code demo'd at tonight's RORO tips and tricks about super
> in Ruby?
> >
> > I tried doinghttps://gist.github.com/1471685and it worked as I expected
> it to.
> >
> > Andrew
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.