def method a = 3 b = 4 some_method_that_gives # [a, b] end

local_variables

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

[:a, :b]