Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created October 28, 2011 16:54
Show Gist options
  • Select an option

  • Save practicingruby/1322758 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/1322758 to your computer and use it in GitHub Desktop.
foo.rb
# 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
@eltiare

eltiare commented Oct 28, 2011

Copy link
Copy Markdown

I think it's a mix of all three, which makes it SUPER AWESOME!

@bonza-labs

Copy link
Copy Markdown

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