从方法参数/参数创建和设置实例变量

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从方法参数/参数创建和设置实例变量相关的知识,希望对你有一定的参考价值。

Inserted at the top of the method body, this line creates instance variables for each of the method parameters and sets them to their respective argument values.
  1. local_variables.each { |v| eval("@#{v}=eval(v)") }

以上是关于从方法参数/参数创建和设置实例变量的主要内容,如果未能解决你的问题,请参考以下文章