2008-09-29から1日間の記事一覧
その1 もっとも一般的なやり方。 str="Hello World" def str.say puts self end str.say その2 特異クラスを定義して、その中でメソッド定義する str="Hello World" class << str def say puts self end end str.say その3 moduleを定義して、extendする …
その1 もっとも一般的なやり方。 str="Hello World" def str.say puts self end str.say その2 特異クラスを定義して、その中でメソッド定義する str="Hello World" class << str def say puts self end end str.say その3 moduleを定義して、extendする …