Created
December 12, 2011 03:37
-
-
Save pasberth/1464656 to your computer and use it in GitHub Desktop.
ごく一般的なRubyによるhello world
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
| # puts "hello world" | |
| # 表のrubyで伝承されるhello worldは↑になる | |
| # しかし裏のrubyで秘伝されるhello worldはこうなるッッッ!! | |
| Object.new.instance_eval do | |
| define_singleton_method :to_s do "hello world" end | |
| Module.new do | |
| define_singleton_method :extended do |sub| | |
| puts sub | |
| end | |
| end.tap { |it| extend it } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment