From: Josh Cheek Date: 2010-08-29T05:06:49+09:00 Subject: Re: Stopping ruby from escaping characters --001485f7c5562e40fd048ee7c5d2 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Aug 28, 2010 at 2:40 PM, Shef wrote: > I'm trying to open a file with variables encased inside the > interpolation operator, but when I open the file it escapes the # > character. I try and gsub it but it reinserts the escape character > anyway. Is there anyway to make ruby ignore the # character so I can > use variables in files? > > When you read it in, it is a String, not code being interpreted. Rather than trying to interpolate data in a file, try using ERB. Here is the example from the docs written using a file rather than string: http://gist.github.com/555505 Here is a quick hopefully straightforward primer: http://github.com/JoshCheek/JoshsRubyKickstart/blob/master/cheatsheets/erb-embedded_ruby.rb --001485f7c5562e40fd048ee7c5d2--