I try it.
method(__method__).parameters.map { |t, v| [v, eval(v.to_s)] }.to_h
Example
def foo(a = 3, b = 'hello', *test)
p method(__method__).parameters.map { |t, v| [v, eval(v.to_s)] }.to_h
end
foo #=> {:a=>3, :b=>"hello", :test=>[]}
I try it.
method(__method__).parameters.map { |t, v| [v, eval(v.to_s)] }.to_h
Example
def foo(a = 3, b = 'hello', *test)
p method(__method__).parameters.map { |t, v| [v, eval(v.to_s)] }.to_h
end
foo #=> {:a=>3, :b=>"hello", :test=>[]}
For further actions, you may consider blocking this person and/or reporting abuse
Saeed Niyabati -
Garvit Gupta -
Aishwarya Raj -
Akarshan Kapoor -
Top comments (0)