Nesting #{} problem

irb(main):040:0> width = nil
=> nil
irb(main):041:0> "door#{" and width #{width}" if width}"
=> "door"
irb(main):042:0> width = 99
=> 99
irb(main):043:0> "door#{" and width #{width}" if width}"
=> "door and width 99"
irb(main):044:0> "door#{" and width=#{width}" if width}"
irb(main):045:0*

I'm stuck :-/

- why does the = change something - other chars work?
- how to fix it?

Seems like an IRB bug:

c:\>ruby -e 'width=99; p "door#{" and width=#{width}" if width}"'
"door and width=99"

Hi,

ยทยทยท

In message "Re: nesting #{} problem" on 04/07/22, "Mehr, Assaph (Assaph)" <assaph@avaya.com> writes:

- why does the = change something - other chars work?
- how to fix it?

Seems like an IRB bug:

I'd call it IRB "limitation". IRB do not parse nested interpolation
well.

              matz.