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
Sulman Baig -
JetThoughts Dev -
BestWeb Ventures -
Alexandre Calaça -
Top comments (0)