Project

General

Profile

Actions

Feature #11919

closed

Passing a module directly

Added by sawa (Tsuyoshi Sawada) over 8 years ago. Updated over 2 years ago.

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

Description

Refinement requires a named module:

module MyRefinement
  refine ...
  ...
end

using MyRefinement

but often (but not always), refinements are called by the using command only in once in a single file, and should not need to be named in such case. Also, the purpose of refinement is to not pollute classes with methods. Necessity to define a module and polluting the name space looks to me to go against this idea.

I would like to do:

using Module.new do
  refine ...
  ...
end

Related issues 2 (1 open1 closed)

Related to Ruby master - Feature #16241: Shorter syntax for anonymous refinementsOpenActions
Related to Ruby master - Feature #14344: refine at class levelRejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0