Project

General

Profile

Actions

Feature #15352

open

Mandatory block parameters

Added by gfx (Goro FUJI) almost 3 years ago. Updated almost 3 years 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"

Actions

Also available in: Atom PDF