Created
October 25, 2011 06:57
-
-
Save loz/1311644 to your computer and use it in GitHub Desktop.
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
File.open('hello.rb', 'wb') {|f| f.write 'class Hello; end' } | |
x = Module.new | |
file = File.open('hello.rb') {|f| f.read } | |
x.module_eval(file) | |
x::Hello | |
#Patch Module: | |
class Module | |
public | |
def load_from_file(file) | |
self.module_eval(File.open(file) {|f| f.read}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment