如何通过名称访问变量
How to access variable by its name
如何通过名称访问变量?
a = Hash.new
a["test"] = 9
some_method(:a) # => {"test" => 9}
a = Hash.new
a["test"] = 9
binding.local_variable_get(:a) # => {"test"=>9}
如何通过名称访问变量?
a = Hash.new
a["test"] = 9
some_method(:a) # => {"test" => 9}
a = Hash.new
a["test"] = 9
binding.local_variable_get(:a) # => {"test"=>9}