Project

General

Profile

Actions

Feature #8571

closed

Refinement inheritance by Module#include

Added by shugo (Shugo Maeda) over 11 years ago. Updated almost 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:55671]

Description

Currently, refinements are not inherited by Module#include.
How about to make using to activate refinements in the ancestors of the specified module?

For example,

module A
refine X do ... end
refine Y do ... end
end
module B
refine Z do ... end
end
module C
include A
include B
end

using C

Refinements in A and B are activated here.

In this code,

using C

is equivalent to

C.ancestors.reverse_each { |m| using m }

This feature enables you to distribute refinements into different modules, and then package the refinements into one module.

Please note that Module#include does't activate refinements in the argument module.

For example,

module C
include A
include B

# Refinements in A and B are not activated here.

end

I've implemented this feature, and have attached the patch.

Updated by matz (Yukihiro Matsumoto) over 11 years ago

  • Assignee changed from matz (Yukihiro Matsumoto) to shugo (Shugo Maeda)

Agreed. It also conforms the original design.

Matz.

Updated by shugo (Shugo Maeda) over 11 years ago

  • Status changed from Assigned to Closed

matz (Yukihiro Matsumoto) wrote:

Agreed. It also conforms the original design.

I've committed in r41719. Thanks.

Actions #3

Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago

  • Project changed from 14 to Ruby master
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0