def greet(greetings, time) unless greetings.key?(time) raise "[ERROR] #{time} is not in #{$var}" end puts greetings[time] end TracePoint.trace(:line) do |tp| $b = tp.binding end TracePoint.trace(:call) do |tp| return unless tp.method_id == :greet greetings = tp.binding.local_variable_get(:greetings) $var = $b.local_variables.detect {|v| $b.local_variable_get(v) == greetings } end english_greetings