How to convert a string text into a class name

There are instances in my tests where I need to pass in the class name as a variable and convert that string to the Class instance variable and instantiate it. This is how I’ve accomplished that in my Ruby step definitions:

Given(/^I visit “(.*?)”$/) do |page|
@page = Object.const_get(page).new # converts string to class var
@page.visit
end