[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Change object class

Seth Doe

3/25/2007 10:55:00 AM

I'm still very new to Ruby and am having trouble with a small script
that I'm working on. I am getting some data from a screen scrape using
hpricot which works well although after I get the data, I wanted to use
the result as a string but the class has changed.

When I print the class with 'puts foo.class' I get the following.

seth@oxygen seth $ ./mon_scraper.rb
Hpricot::Elem

How would I go about getting this to be

seth@oxygen seth $ ./mon_scraper.rb
String

Regards,

Seth

--
Posted via http://www.ruby-....

2 Answers

Alex Young

3/25/2007 11:16:00 AM

0

Seth Doe wrote:
> I'm still very new to Ruby and am having trouble with a small script
> that I'm working on. I am getting some data from a screen scrape using
> hpricot which works well although after I get the data, I wanted to use
> the result as a string but the class has changed.
>
> When I print the class with 'puts foo.class' I get the following.
>
> seth@oxygen seth $ ./mon_scraper.rb
> Hpricot::Elem
>
> How would I go about getting this to be
>
> seth@oxygen seth $ ./mon_scraper.rb
> String
>
Use the Hpricot::Elem#to_html method.

--
Alex

Seth Doe

3/25/2007 11:59:00 AM

0

Gah! Genius. Thank you.


Alex Young wrote:
> Seth Doe wrote:
>> How would I go about getting this to be
>>
>> seth@oxygen seth $ ./mon_scraper.rb
>> String
>>
> Use the Hpricot::Elem#to_html method.


--
Posted via http://www.ruby-....