红宝石中有这样的东西吗?
send(+, 1, 2)
Run Code Online (Sandbox Code Playgroud)
我想让这段代码看起来不那么多余
if op == "+"
return arg1 + arg2
elsif op == "-"
return arg1 - arg2
elsif op == "*"
return arg1 * arg2
elsif op == "/"
return arg1 / arg2
Run Code Online (Sandbox Code Playgroud)