A
aurelianito
We all know the #{} operator for String interpolation.
It's used like this:
name="Aure"
greeting="hi, #{name}"
and greeting evaluates to "hi, Aure". But I would like to change it.
Is there a pure Ruby way to force "hi, #{name}" to evaluate to "hi,
AURE" (get the uppercase of the original interpolated String).
Something like:
class String
# do some magic here
end
name="Aure"
greeting="hi, #{name}"
and now greeting evaluates to "hi, AURE". Is there a method in String
to override in order to take control of the String interpolation?
Thanks in advance,
Aureliano.
It's used like this:
name="Aure"
greeting="hi, #{name}"
and greeting evaluates to "hi, Aure". But I would like to change it.
Is there a pure Ruby way to force "hi, #{name}" to evaluate to "hi,
AURE" (get the uppercase of the original interpolated String).
Something like:
class String
# do some magic here
end
name="Aure"
greeting="hi, #{name}"
and now greeting evaluates to "hi, AURE". Is there a method in String
to override in order to take control of the String interpolation?
Thanks in advance,
Aureliano.