Created
July 26, 2010 16:16
-
-
Save hawx/490778 to your computer and use it in GitHub Desktop.
This is how I would maybe work around the problem of scoping monkey patches. Which should be coming in Ruby 2.0
This file contains 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 Test | |
class String < ::String; end | |
p String.new("Test::String").class | |
#=> Test::String | |
p ::String.new("::String").class | |
#=> String | |
p "::String".class | |
#=> String -> Would be better as Test::String | |
end | |
p Test::String.new("Test::String").class | |
#=> Test::String | |
p String.new("::String").class | |
#=> String | |
p "::String".class | |
#=> String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment