From: Jano Svitok Date: 2007-05-14T18:57:04+09:00 Subject: Re: Probs with accessing variables in yaml file On 5/14/07, Rebhan, Gilbert wrote: > > > Hi, > > don't know if there's another | better way, but > i solved it like that = > > yaml has now = > > replaceto1: " replaceto2: "]>" > > > and my script has = > > s=config['replaceto1']<<"#{@cvsreg}"< [...] > filesed!(config['replacefrom'],s,"#{file}") Hi, the #{} are evaluated when the string is instantiated, i.e. in normal case when the line containing the literal (note: the LITERAL) is evaluated. When you load the string from yaml, these #{} are not evaluated at all. What you might want to do is to add quotes around and call eval -- e.g. config['replaceto'] = eval("\"#{config['replaceto']}\""), with all the dangerous implications of eval. (Note the double use of #{}... once it is evaluated as the line is parsed to create another literal that is then passed to eval to expand again. I could have avoided the outer expansion by using "\"" + config[...] + "\"", but I guess this one's faster), and it's shorter in any case.)