如何将调用者参数的值分配为参数的默认值?我希望该方法将调用者方法Callme#callme
的参数值作为默认参数值。name
TheCaller#caller
module Callme
def callme(hero = name)
hero
end
end
class TheCaller
include Callme
def caller(name)
callme
end
end
say = TheCaller.new
say.caller("superman")
# => expecting "superman"