Project

General

Profile

Actions

Bug #11099

closed

def assert method raise syntax error

Added by roroco (roro co) almost 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
[ruby-core:68993]

Description

In ruby 2.2, when i try

def assert(*args, &blk)

end

assert(a > 0 and a < 1)

it will raise

Uncaught exception: /home/roroco/Dropbox/rbs/ro_btc/ex/ex.rb:5: syntax error, unexpected keyword_and, expecting ')'
assert(a > 0 and a < 1)

Updated by roroco (roro co) almost 9 years ago

class AsrErr < StandardError

end

def asr(r, msg=nil, *args, &blk)
  unless r
    if msg
      raise AsrErr
    end
  end
end

a = 2
asr (a > 0 and a < 1)

I hope asr(a > 0 and a < 1) can also work

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

It's a spec, and has lower precedence.

Actions

Also available in: Atom PDF

Like0
Like0Like0