From: Navindra Umanee Date: 2005-07-17T00:59:00+09:00 Subject: Re: delaying string evaluation Ara.T.Howard wrote: > why not make up a mini interpolator? > > ~ > cat a.rb > class String > def expand! h = {} > gsub!(%r/:\w+/o){|k| h[k.delete(':').intern] || k} > end > def expand(*a, &b) > dup.expand!(*a, &b); self > end > end Interesting. As a general solution I'm not sure it's what I want. I am also expanding complex objects (e.g #{posting.attribute}) and with your custom interpolator I would end up either having to copy information around (e.g. :posting_attribute => posting.attribute) or using it with the regular delayed string interpolation strategy anyway. Thanks, Navin.