Small refactor for RubyObject.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>