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
Luigi Antonio Guillen -
Lucian Ghinda -
JetThoughts Dev -
meleu -
Top comments (0)