Try the send method, which invokes the method named by the first argument and passes it any succeeding parameters. To use your example: b = 'button' puts $ie.send(b, :index,1)