Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6676309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:58:18+00:00 2026-05-26T03:58:18+00:00

I have the following code: address = #{(article/div.address).inner_html.strip_html.squish} (using Hpricot) And in some instances…

  • 0

I have the following code:


address = "#{(article/"div.address").inner_html.strip_html.squish}"

(using Hpricot)

And in some instances…


address = "#{(article/"div.address").inner_html.strip_html.squish}"

…is nil

I would like the script to keep chugging along, possibly replacing nil with an empty string.

Any tips?

Edit

I have traced the problem better to:

puts "#{link[0].to_s}\n" unless link.empty?

(.backtrace points to this particular line in the source.)

So the revised question is: why doesn’t that line just not get parsed? Why does it throw an error? I thought that using unless will just skip it…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:58:18+00:00Added an answer on May 26, 2026 at 3:58 am

    Thank you all for the support and helpful tips, in the end it was a matter of using the proper method, I ended up solving my problem by using:

    unless uri.query.nil?

    But I did come to make use of both .to_s and try in my source, and I wish I could pick two answers as the right one!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery Address Plugin and I have the following code. $.address.change(function(e) {
I have following code which successfully sent email using Gmail address. But when i
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
We have following code: try { // some code throwing MyException } catch (MyException
i have following code for inserting another page into div An XHTML 1.0 Strict
I have the following line of code: LPSTR address = T2A((LPTSTR)hostAddress); Can I convert
I have the following code: $sql = SELECT name, address, city FROM tableA, tableB
I have the following code jQuery.getJSON(encodeURI(strUrl), {address:address,state:state, zip:zip},function(data){ alert('HELLO World!'); }); If for some
I have the following code: HTML: <label id=copyAddress class=copyAddress onclick=CopyAddress(this);> Copy Address </label> JS:
I have the following code that sends a message using the mail() function. Everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.