Delayed quote expansion
- From: Kevin Olbrich <kevin.olbrich@xxxxxxxx>
- Date: Wed, 18 Jan 2006 14:29:56 +0900
I'm sure the answer to this will seem simple once I see it. Right now
it eludes me.
How can one have a string object like this...
a = '#{some_value}'
and have it get evaluated as a double quoted string (with the value for
some_value being automatically replaced) at a later time?
I would prefer that it is evaluated in context from which it is called.
I would like to do something like this...
def func(param)
test = 42
puts param.quote_substitution
end
func('my number is #{test}') #=> "my number is 42"
_Kevin
--
Posted via http://www.ruby-forum.com/.
.
- Follow-Ups:
- Re: Delayed quote expansion
- From: Paolo Capriotti
- Re: Delayed quote expansion
- From: Eero Saynatkari
- Re: Delayed quote expansion
- From: gwtmp01
- Re: Delayed quote expansion
- Prev by Date: Re: PDF::Writer and table columns
- Next by Date: Re: Looping through files using exec
- Previous by thread: Slowing down Watir tests
- Next by thread: Re: Delayed quote expansion
- Index(es):
Relevant Pages
|