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

  • Home
  • SEARCH
  • 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 7939055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:58:58+00:00 2026-06-03T22:58:58+00:00

I am working with some code I found online: def person_path(options) # This is

  • 0

I am working with some code I found online:

def person_path(options)
  # This is where the path of the query is constructed.

  path = "/people/"     # For this section of the LinkedIn API
  if id = options.delete(:id)
    path += "id=#{id}"
  elsif url = options.delete(:url)
    path += "url=#{CGI.escape(url)}"
  else
    path += "~"
  end
end 

I am not completely certain what it does. what I am trying to do is have it construct a string something like this: http://api.linkedin.com/v1/people/~:(current-status) which I got from the LinkedIn developer docs here: https://developer.linkedin.com/documents/profile-api

Any thoughts on what I should pass this functions and how exactly it accomplishes what it does?

Thanks!

  • 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-06-03T22:59:00+00:00Added an answer on June 3, 2026 at 10:59 pm

    Whilst it’s not stated what ‘options’ is, it’s extremely common to pass in options to a method as a Hash of key-value pairs in Ruby, so I’d say that options is just that (with 99% certainty). This is the part that’s key to understanding the rest of the code.

    I believe that the #delete method on hash is being used in order to pull out the key-value pair and assign the value in one move, whilst taking advantage of the returned object’s “truthiness”.

    http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-delete

    And by “truthiness”, I mean that in Ruby, all objects evaluate to ‘true’ except ‘nil’ and ‘false’.

    The rest is simple if-else control flow logic that you will have seen in any other language, so I hope this makes sense.

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

Sidebar

Related Questions

I have some code which I found online and it's working great. It lists
Recently I was working with some JavaScript code and I found this: <script type=text/javascript>
I'm working on some code that retrieves a section of a Wikipedia page as
Working on some code today, I found that the following would work in 5.3,
Hey people yesterday i was working on some code and thought that i would
I have been working with some code I found here to help me with
I'm working some code that inserts csv rows into an SQLite database using Python.
I've been re-working some code due to a memory leak. The code is part
Working on some code for a machine problem; we've just started working with pointers,
I am working with some code which outputs a 3x3 rotation matrix and a

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.