Project

General

Profile

Feature #15352

Mandatory block parameters

Added by gfx (Goro FUJI) over 1 year ago. Updated over 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:90105]

Description

There are too many block parameter assertions (it's kind of idioms: raise NoBlockGiven unless glock_given?).

It's very useful if there's a syntax to declare mandatory block parameters, such as:

def foo(&!block)
  block.call
end

foo() # raises ArgumentError "in `foo`: no block given"

Also available in: Atom PDF