Cheng Cheng - 1 month ago 11
Ruby Question

How to list local-variables in Ruby?

def method
a = 3
b = 4

some_method_that_gives # [a, b]
end

Answer

local_variables

It outputs array of symbols, presenting variables. In your case: [:a, :b]