Last active
December 17, 2015 05:59
-
-
Save atton/5562192 to your computer and use it in GitHub Desktop.
flush するスタイルに変更
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
#!/usr/bin/env ruby | |
# Okinawarb.new.H.e.l.l.o.comma.space.w.o.r.l.d!.flush("\n") | |
# => output 'Hello, wrold!' | |
class String | |
CharTable = {comma:',', space:' '} | |
def flush str | |
print self, str | |
end | |
def method_missing name, *args | |
return self + (CharTable[name] || name).to_s | |
end | |
end | |
class Okinawarb < String | |
end | |
Okinawarb.new.H.e.l.l.o.comma.space.w.o.r.l.d!.flush("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment