Feature #8846
closedPublicize Module#include
Description
I propose changing Module#include to a public method.
-
Background
Module#include is currently a private method.
However, the method is actually quite often used (particularly by gem library authors) for appending some features from outside of the target module, such as:ActiveRecord::Base.send :include, MyPagination
-
Use case
% cd rails
% git grep "send[ (]:include," | wc -l
45
Files
Updated by matsuda (Akira Matsuda) about 11 years ago
- File deleted (
public_include.pdf)
Updated by matsuda (Akira Matsuda) about 11 years ago
- File public_include.pdf public_include.pdf added
Updated by matz (Yukihiro Matsumoto) about 11 years ago
The basic motivation behind #include (and #prepend) being private is we didn't assume that kind of coding style.
As it turned out, that coding style became popular, I'd accept make them public.
Matz.
Updated by marcandre (Marc-Andre Lafortune) about 11 years ago
Great :-)
Taking Rails as an example, I find that the next in line are define_method
, remove_const
, alias_method
and attr_*
As I stated in #6539, I believe these should be public also.
Updated by matsuda (Akira Matsuda) about 11 years ago
- Status changed from Open to Closed
Implemented in r42809.
Updated by duerst (Martin Dürst) about 11 years ago
Hello Marc-Andre,
On 2013/09/01 4:20, marcandre (Marc-Andre Lafortune) wrote:
Issue #8846 has been updated by marcandre (Marc-Andre Lafortune).
Great :-)
Taking Rails as an example, I find that the next in line are
define_method
,remove_const
,alias_method
andattr_*
As I stated in #6539, I believe these should be public also.
#6539 is marked closed. Best to open a new issue. Regards, Martin.
Feature #8846: Publicize Module#include
https://bugs.ruby-lang.org/issues/8846#change-41506Author: matsuda (Akira Matsuda)
Status: Open
Priority: Low
Assignee:
Category: core
Target version: current: 2.1.0I propose changing Module#include to a public method.
Background
Module#include is currently a private method.
However, the method is actually quite often used (particularly by gem library authors) for appending some features from outside of the target module, such as:ActiveRecord::Base.send :include, MyPagination
Use case
% cd rails
% git grep "send[ (]:include," | wc -l
45
Updated by mrkn (Kenta Murata) almost 8 years ago
- Related to Feature #12697: Why shouldn't Module meta programming methods be public? added