Hello...
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?
Thanks!
Martin
The problem is partially in irb. Your code works if you put it in a Ruby file
and go from there. However, your code will be easier to understand and even irb
gets it if you switch one of the two quoted strings to use an
alternative quote, e.g.,
irb(main):001:0> width = nil
=> nil
irb(main):002:0> %Q(door#{" and width #{width}" if width})
=> "door"
irb(main):003:0> %Q(door#{" and width=#{width}" if width})
=> "door"
irb(main):004:0> width = 99
=> 99
irb(main):005:0> %Q(door#{" and width #{width}" if width})
=> "door and width 99"
irb(main):006:0> %Q(door#{" and width=#{width}" if width})
=> "door and width=99"
-austin
···
On Thu, 22 Jul 2004 12:42:02 +0900, Martin Pirker <crf@sbox.tu-graz.ac.at> wrote:
Hello...
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?
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca
The problem is partially in irb
[...]
if you switch one of the two quoted strings to use an alternative quote,
works - thanks!
I still consider irb and .to_yaml the most useful testing tools, tripping on
an irb issue can happen 
Martin
PS: Sadly, of the replies only 107141 and 107155 made it to my point of
NNTP world, 107[140|144|147|148] seem to be lost - bad ratio :-/
Google groups has all 6 replies.
···
Austin Ziegler <halostatue@gmail.com> wrote: