IN Ruby you can do interpolation in double-quoted strings with the #{ } operator. The expression between the curlies is evaluated and passed to the result's to_s method, then stuffed into the string. So you'd create a string of html: html = %Q{ <html> <head> <base href="#{myroot}" /> <link rel="stylesheet" href="resources/css/webdialogs.css" /> </head> <body> </body> </html> } my_dialog.set_html(html) You can also use a HEREDOC. See: http://ruby-doc.org/core-2.0.0/doc/syntax/literals_rdoc.html