Skip to content

Instantly share code, notes, and snippets.

@j05h
Created July 9, 2010 22:01
Show Gist options
  • Save j05h/470131 to your computer and use it in GitHub Desktop.
Save j05h/470131 to your computer and use it in GitHub Desktop.
class A
class B
def self.const_get(n)
self.const_set(n,Class.new(self){
self.const_set("D",Class.new(self))
})
end
end
end
puts A::B::C::D rescue puts $!
puts A::B::const_get("C")::D
puts A::B::C::D
@j05h
Copy link
Author

j05h commented Jul 9, 2010

Because I was writing tickets and this was mildly interesting.

https://twitter.com/jimweirich/status/18146278002

@j05h
Copy link
Author

j05h commented Jul 9, 2010

Yes, I have nothing better to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment