2012-03-07から1日間の記事一覧
def hoge(a, b, c) p self.method(__callee__).parameters #=> [[:req, :a], [:req, :b], [:req, :c]] end hoge(1, 2, 3) Kernel.#__callee__とMethod#parametersを使う。 __callee__で今いるメソッドの名前がSymbolとして取れるので、それをself.methodの引…
def hoge(a, b, c) p self.method(__callee__).parameters #=> [[:req, :a], [:req, :b], [:req, :c]] end hoge(1, 2, 3) Kernel.#__callee__とMethod#parametersを使う。 __callee__で今いるメソッドの名前がSymbolとして取れるので、それをself.methodの引…