Saturday, November 9, 2013

Re: [Rails] how to search the phrase of numbers

On Nov 8, 2013, at 7:54 PM, Dina Z. <lists@ruby-forum.com> wrote:

> Hi,Dear all,
>
> I am trying to search the phrase of numbers in a html page in the
> sentence below:
>
> <div class="Results" id="yui_3_11_0_4_1383957936583_5009">(253
> items)</div>
>
> I used this piece of code, but it does not work,
>
> limit= page.search("div[class=Results]").search("div").gsub("items","")
>
> begin
> Integer(limit)
> rescue
> return 0
> end
>
> Would you give me any suggestion on this?

Break apart the chain of method calls above, and see what each is returning.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6CFB830C-8024-4896-8E69-5361104D3A8F%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate