Hi --

On Tue, 21 Aug 2007, Marcin Tyman wrote:

> Hi,
> I need to know how to "cast" ruby objects on another i.e.
>
> arr = Array.new()
> doc = REXML::Document.new(grListXML)
> doc.elements.each("*/group") do |el|
>    temp = el.elements["id"].get_text
>     arr << temp
> end
>
> 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

-- 
* 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)