Created
September 7, 2011 12:08
-
-
Save floere/1200402 to your computer and use it in GitHub Desktop.
Decoration using extend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Decoration | |
| def something | |
| p :in_decoration_calling_super | |
| super | |
| p :after_super | |
| end | |
| end | |
| class Thing | |
| def something | |
| p :in_thing | |
| end | |
| end | |
| thing = Thing.new.extend Decoration | |
| thing.something # => | |
| # :in_decoration_calling_super | |
| # :in_thing | |
| # :after_super |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment