Refactored string_manipulator.rb