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
Govind.S.B -
Schuster Braun -
Aditya Pratap Bhuyan -
Teddy Zugana -
Top comments (0)