Last active
December 10, 2015 12:08
-
-
Save bachue/4431893 to your computer and use it in GitHub Desktop.
You can require a file with class description in a method, it works. But you can't include a class description directly in a method, it will cause SyntaxError, please check https://gist.github.com/4431884
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
// main file | |
def f | |
require '2' | |
puts C.new.g | |
end | |
f # => 'hello world' | |
// 2.rb | |
class C | |
def g | |
'hello world' | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment