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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:45:54+00:00 2026-06-03T06:45:54+00:00

I’m looking to write a quiz application to help folks new to the Ruby

  • 0

I’m looking to write a quiz application to help folks new to the Ruby language (such as myself) learn Ruby.

I’m interested in writing a program which will prompt the user with a question, start an Interactive Ruby Shell (IRB) session, set the preconditions, allow the user to interact with the shell, and then check the post conditions to see if the user followed the prompt and answered the question correctly. For example, the user could be prompted to combine two arrays containing days of the week. The shell session would be started, and the preconditions would be set:

days1 = ["Mon", "Tue", "Wed"]
days2 = ["Thu", "Fri", "Sat", "Sun"]

The user would then be able to interact with the shell, and would presumably do something like this:

days = days1 + days2
=> ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

The program would then evaluate the post conditions to verify that the two array had been combined. The program may also have to take a look at specifically how the task was accomplished, if the prompt specified that it must be accomplished in a particular way.

What’s the best way to handle the interaction with IRB? One idea would be to use Expect, but I was wondering if you had a better method or perhaps a method that only involved using Ruby. I’m not looking to reinvent the wheel, so if there is already a program like this available, I’m open to using that instead of doing custom development.

  • 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-03T06:45:55+00:00Added an answer on June 3, 2026 at 6:45 am

    You might look at the alternative of irb, the pry. With pry your task is looked easier for me.

    require 'pry'
    
    days = nil
    days1 = ["Mon", "Tue", "Wed"]
    days2 = ["Thu", "Fri", "Sat", "Sun"]
    
    binding.pry :quiet => true
    
    if days == (days1 + days2)
        puts "Congratulations!!!"
    else
        puts "You did something wrong"
    end
    

    The only problem with it that the binding command automatically calls the whereami command which prints the surrounding context of the binding point. I don’t know yet how to cancel it. Fixed, thanks to banister.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am writing an app with both english and french support. The app requests
I would like to count the length of a string with PHP. The string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.