From: John Joyce Date: 2007-08-22T02:38:01+09:00 Subject: Re: How to "cast" in Ruby On Aug 21, 2007, at 10:19 AM, Phrogz wrote: > On Aug 21, 7:12 am, Kaldrenon wrote: >> On Aug 21, 8:13 am, Marcin Tyman wrote: >> >>> David, >>> Your solution doesn't work correctly. I've resolved this like that >> >>> temp = String.new("#{el.elements["id"].get_text}") >>> arr << temp.to_i >> >> How about: arr << "#{el.elements["id"].get_text}".to_i ? > > If you ever are tempted to write: > "#{foo}" > you should realize that it's functionally equivalent to > foo.to_s > > True, but for some (myself included) it definitely stands out more, being more readable. But usage depends on context.