如何通过变量名访问变量?
a = Hash.new a["test"] = 9 some_method(:a) # => {"test" => 9}
a = Hash.new a["test"] = 9 binding.local_variable_get(:a) # => {"test"=>9}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
点击生成二维码
我来说两句