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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:35:43+00:00 2026-06-12T12:35:43+00:00

I was looking at Sinatra and trying to understand the syntax: require ‘sinatra’ get

  • 0

I was looking at Sinatra and trying to understand the syntax:

require 'sinatra'

get '/' do
  "Hello, World!"
end

I understand it does this:

This is a ‘Route’. Here, we’re telling Sinatra that if the home, or root, URL ‘/’ is requested, using the normal GET HTTP method, to display “Hello, World!”

But what is happening the Ruby language?

  1. What does this syntax mean: get '/'? Is get a method and ‘/‘ a parameter to it? If it is method, then in Ruby, I can call a method as methodname (parameter) {}. What is { } there for?
  2. I usually understand do and end as { }, which are kinds of enclosures to function bodies.
  3. Between do and end we have “Hello, World!” so is it a statement? What I mean is, it is getting printed, but we did not call it as print "Hello, World!", so what is going on?
  4. It seems get is a method defined in Sinatra, but if I add a gem, where there is a get method already defined, then how do I know which ‘get’ method it would call? Or, does it refer to the HTTP get method?

I am sorry if this question sounds very basic, but I want to get through it before I move forward.

  • 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-12T12:35:45+00:00Added an answer on June 12, 2026 at 12:35 pm

    May I suggest going through a tutorial on ruby before tackling a larger problem like sinatra which is a fairly specialized library.

    A good place to start is with the Ruby Koans

    As for your questions.

    1. get is a method. '/' is its argument. and do ... end denotes a block in ruby just like {} would.
    2. Yeah that’s what do ... end are
    3. Blocks in Ruby return the last value calculated by default so in the is case having a string is the same as having return "String".
    4. If you are getting a namespace collision, Ruby will complain. In this case get is the sinatra defined method get. Abstractly it stands for an HTTP GET request against the server.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking at the following code, does theme[sprite].img get nested inside result[definition].data (as theme[sprite].img is
Looking at the output of this particular method is confusing to me. I'm trying
I am looking to add an ORM to my existing Sinatra app. I went
What payment gateway library works with Sinatra if you're looking to add ecommerce functionality
Looking to do a bit of refactoring... Using NHibernate I have this query currently
Looking at the Ehcahce implementation of net.sf.cache.JS107, I am trying to achieve the following
Looking for best advice on how to do this: I have an insert like
I'm trying to implement single sign-on using facebook in my ruby sinatra app. So
I'm looking for an image url helper for sinatra that allows me to do
What is the correct way to route your request through Sinatra so that it

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.