From: Shannon Fang [mailto:xrfang@hotmail.com]
case header.to_s.intern
^^^^^^^^^
when :TO, :CC, :BCC
…
when :FROM
…
end
Use #intern
···
-----Original Message-----
From: Shannon Fang [mailto:xrfang@hotmail.com]
case header.to_s.intern
^^^^^^^^^
when :TO, :CC, :BCC
…
when :FROM
…
end
Use #intern
-----Original Message-----
Hi,
Tks. But can anybody comments if it worth to convert
case string
when "string1"
...
to
case string.intern
when :string1
??
Thanks.
Shannon
On Tue, 3 Dec 2002 08:50:51 +0900 David Naseby david.naseby@eonesolutions.com.au wrote:
-----Original Message-----
From: Shannon Fang [mailto:xrfang@hotmail.com]
case header.to_s.intern
^^^^^^^^^
when :TO, :CC, :BCC
…
when :FROM
…
endUse #intern
The data you are comparing is a String, so I would just use strings. Symbols
have their uses, but they are not supposed to take over the world.
David Naseby identified a speed difference, but that will only affect you if
you are doing a lot of comparisons.
Therefore, I recommend:
case header.lowercase
when “to”, “cc”, “bcc”
…
when “from”
…
end
Good luck.
Gavin
----- Original Message -----
From: “Shannon Fang” xrfang@hotmail.com
Hi,
Tks. But can anybody comments if it worth to convert