動的メソッドで呼び出すメソッドが引数ありと引数なしの場合の呼び出し方
Apr 17th, 2013
1
2
3
4
5
6
7
8
9
10
11
12
13
|
class Hoge
def call_with_args(message)
p messge
end
def call_without_args
p "引数なしのメソッド"
end
end
hoge = Hoge.new
method = bol ? [:call_with_args, "引数あり" ] : [:call_without_args]
hoge.send(*method)
|