How to express "pointer to this instance"?

How do I express pointer of this instance in code?

class ColorSampler
  ...

  def handle_mouse_up()
    ev = LibSDL::Event.new
    ...
    ev.user.data1 = pointerof(self)
    ...

    LibSDL.push_event(pointerof(ev))
  end
end
| ev.user.data1 = pointerof(self)
Error: can't take address of self

Ah, this aligns with my comment here: SDL Event and UserEvent questions - #8 by straight-shoota

ColorSampler is a class and self is a reference to an instance. Thus it is already a pointer.
You can cast it to a different pointer type: ev.user.data1 = self.as(Void*).