Then it seems that my search results are in an array, but that both
prices are in a single element in the array because both come up when I
ask for the element at [0]
I'm a ruby newbie--what am I missing?
Thanks very much
--
Posted via http://www.ruby-forum.com/.

Advertisements

Christiaan Venter wrote:
> Hi,
>
> I have a question about using Hpricot.
>
> If I do something like this
>
> doc = open("F:/search.html") { |f| Hpricot(f) }
> doc.search(".price").each do |price|
> prices = [price.inner_text]
> puts prices[0]
>
> =>$21.95
> $15.95
>
> Then it seems that my search results are in an array, but that both
> prices are in a single element in the array because both come up when I
> ask for the element at [0]
> I'm a ruby newbie--what am I missing?
> Thanks very much

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!