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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:38:59+00:00 2026-06-11T22:38:59+00:00

As an exercise to learn Ruby, I would like to create a script that

  • 0

As an exercise to learn Ruby, I would like to create a script that will be run from the terminal. It should accept as input either a string or a text file and it should output the result of various string parsing mechanisms that I will write myself.

To get me started, would you please translate this pseudo-code into proper Ruby for me?

  1. In terminal: ruby myscript.rb (either a string or a text file).
  2. In myscript.rb: Retrieve input. Set my_input to the input.
  3. Set my_output to the result of various_string_parsing_voodoo (done to my_input).
  4. puts my_output

I intend to actually write the code myself, but if someone could supply me with a skeleton .rb file to send in “Hello World” and get “[World] is pleased by your [hello]” or something equally inane that’d be a great help.

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

    Here are some key pieces:

    • ARGV is an array containing the arguments you passed when running your script from command line.
    • the File class contains several utilies. For example, File.exists?(path) returns true if the path exists, and File.file?(path) returns true if the path exists and is a file (not a dir).

    I think this may help you quite a bit.

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

Sidebar

Related Questions

I am trying to learn rails from http://ruby.railstutorial.org/ Exercise 3 explains to install rspec,
I searched the site but it seems like this exercise from the book Learn
I'm on Chapter 33 of Learn Ruby the Hard Way. Extra credit exercise 1
The exercise says: Create a Text class that contains a string object to hold
In an effort to learn more about networking I'd like to do an exercise:
I have this small application that I'm building as an exercise to learn the
I am starting to learn OpenMP, running examples (with gcc 4.3) from https://computing.llnl.gov/tutorials/openMP/exercise.html in
I am working on Exercise 49 of Learn Ruby the Hard Way The exercise
I'm working on this Exercise 49 in Learn Ruby the Hard Way The exercise
I am trying to learn ruby, and i am trying to do the exercise

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.