Hi --

On Tue, 21 Aug 2007, Marcin Tyman wrote:

> David A. Black wrote:
>> Hi --
>>
>> On Tue, 21 Aug 2007, Marcin Tyman wrote:
>>
>>> I want to convert temp variable to intager. Is is any simple way to do
>>> it if REXML has no to_i methods?
>>
>> If temp is a string, then it does have a to_i method, and you can call
>> that:
>>
>>    arr << temp.to_i
>>
>>
>> David
>
> 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

I think text (rather than get_text) will give you a string. In any
case, you don't need that whole line; at the very least you can get
rid of String.new :-)


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)