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 9197765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:08:33+00:00 2026-06-17T22:08:33+00:00

Here is a sample code from a RSpec code: describe Thing do def create_thing(options)

  • 0

Here is a sample code from a RSpec code:

describe Thing do
  def create_thing(options)
    thing = Thing.new
    thing.set_status(options[:status])
    thing
  end

  it "should do something when ok" do
    thing = create_thing(:status => 'ok')
    thing.do_fancy_stuff(1, true, :move => 'left', :obstacles => nil)
    ...
  end
end

So my confusion is mostly on this line:

thing.set_status(options[:status])

So create_thing method has an “option” parameter then we are passing status part of that parameter? Can someone explain this syntax in some easier words?

  • 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-17T22:08:34+00:00Added an answer on June 17, 2026 at 10:08 pm

    options is just a variable. The part you need to understand is this part

    thing = create_thing(:status => 'ok') 
    

    You are basically passing a Hash to create_thing and therefore options is a hash. Then you can access the value of the status key by doing options[:status].

    If the above mentioned line looked like this

    thing = create_thing("Foo")
    

    options would be “Foo” and you could get an error trying to do something like options[:status]

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

Sidebar

Related Questions

Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
I've copied all the code from here but instead of looking like the sample
BeautifulSoup newbe... Need help Here is the code sample... from mechanize import Browser from
I have a very simple C++ code sample here: char *s = new char[100];
I found some sample code from here . static UIImage *backgroundImageDepressed; /** * */
I found email composer sample code from iphone OS Ref Library. Here is a
Here is some sample code from three files: // foo.js var myFunc = require(./myFunc);
Here is some sample code from iOS: NSDate *startDateX = [NSDate date]; // Do
I have written a code from the answer given here My sample code is

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.