Project

General

Profile

Actions

Feature #17475

closed

Implement arguments forwarding for blocks

Added by svoop (Sven Schwyn) almost 4 years ago. Updated almost 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:101720]

Description

In a gem, I create a bunch of initializer shortcuts as follows:

# Shortcut initializers
CLASSES.each do |element, class_name|
  define_singleton_method(element) do |*args, **kwargs|
    class_name.to_class.new(*args, **kwargs)
  end
end

Given the new, cool arguments forwarding with ..., it would be a real beauty if the following were possible:

# Shortcut initializers
CLASSES.each do |element, class_name|
  define_singleton_method(element) do |...|
    class_name.to_class.new(...)
  end
end

(I'm sorry if this is a duplicate. In some dusty corner of my memory, I believe to have seen a similar issue in the past, but couldn't find it anymore... maybe just dreamt of it. :-)

Updated by svoop (Sven Schwyn) almost 4 years ago

Found it, duplicate of rejected #16605. Sorry for the noise, can be closed/rejected.

Actions #2

Updated by jeremyevans0 (Jeremy Evans) almost 4 years ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0