Created
October 28, 2011 16:54
-
-
Save practicingruby/1322758 to your computer and use it in GitHub Desktop.
foo.rb
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
| # is this evil, weird, or awesome? | |
| module ExtendedExtend | |
| def extend(*args, &block) | |
| if args.empty? | |
| super(Module.new(&block)) | |
| else | |
| super | |
| end | |
| end | |
| end | |
| class Object | |
| include ExtendedExtend | |
| end | |
| x = "blah" | |
| x.extend do | |
| def yell | |
| "#{upcase}!!!!!" | |
| end | |
| end | |
| puts x.yell |
Looks pretty normal to me... I must be spending too much time with javascript
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it's a mix of all three, which makes it SUPER AWESOME!