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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:32:09+00:00 2026-06-14T16:32:09+00:00

I am running Ruby 1.9. This is a valid syntax: items = (data[‘DELETE’] ||

  • 0

I am running Ruby 1.9.

This is a valid syntax:

items = (data['DELETE'] || data['delete'] ||
         data['GET'] || data['get'] || data['POST'] || data['post'])

But this gives me an error:

items = (data['DELETE'] || data['delete']
         || data['GET'] || data['get'] || data['POST'] || data['post'])

t.rb:8: syntax error, unexpected tOROP, expecting ')'
         || data['GET'] || data['get'] |...
           ^

Why?!

  • 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-14T16:32:12+00:00Added an answer on June 14, 2026 at 4:32 pm

    What I can say is “that’s just how it works”.

    The Ruby parser does an amazing job, in general, of figuring out when an expression needs to continue on another line. Just about every other language in the world completely punts on this problem and requires an actual character to either continue to the next line or terminate the statement.

    As you know, Ruby is special in that, almost always, it just figures it out.

    In this case, though, there is a conflict. The parser knows that your expression isn’t finished, because it’s still looking for the ), but it could be a compound expression.

    For example, you could be writing something like this:

    (p :a; p :b; p :c)
    

    …but using the newline soft terminator instead of ; … this syntax below does actually work:

    (p :a
     p :b
     p :c)
    

    (BTW, the value of that expression is the value of the last expression in the sequence.)

    Ruby can’t parse both your statement and the above one without a better hint such as a binary operator that clearly requires another line.

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

Sidebar

Related Questions

I'm running Ubuntu 11.10 and installed Ruby 1.9 like this: $ sudo apt-get install
I'm trying to use rspec with mongoid but I'm running across this error: undefined
I tried starting my Rails application but got this error message from Passenger: Ruby
I'm running Ruby ruby 1.9.3p125 and I keep getting this error which is making
Is there an easy way, when running a Ruby script, to get it to
running: ruby 1.9.3p0 with Rails 3.2.1 Trying to use rspec but when I try
I've tried this on a few machines on different networks, all running ruby 1.8.7
I'm stuck with this problem. cat ~/.rvm/gems/ruby-1.8.7-p249/gems/nokogiri-1.4.1/ext/nokogiri/mkmf.log Gives this errors (clipped) conftest.c:3: error: 'xmlParseDoc'
In trying to learn about Ruby execution methods, I found this blog post on
I'm running Ruby 1.9.2p290 and Rails 3.1.0.rc5. When I run this regex it matches

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.