Refactor rubydoesenc into a method