[#83107] Alias Enumerable#include? to Enumerable#includes? — Alberto Almagro <albertoalmagro@...>

Hello,

9 messages 2017/10/04

[ruby-core:83458] [Backport193 Backport#8284][Rejected] Expected behavior of Module#public_class_method

From: usa@...
Date: 2017-10-21 12:20:45 UTC
List: ruby-core #83458
Issue #8284 has been updated by usa (Usaku NAKAMURA).

Status changed from Assigned to Rejected

1.9.3 is out of date

----------------------------------------
Backport #8284: Expected behavior of Module#public_class_method
https://bugs.ruby-lang.org/issues/8284#change-67443

* Author: jacknagel (Jack Nagel)
* Status: Rejected
* Priority: Normal
* Assignee: usa (Usaku NAKAMURA)
----------------------------------------
It was pointed out by Myron Marston (here: https://gist.github.com/myronmarston/5401829) that calling public_class_method on an anonymous module makes the named method public on Object, etc.

Object.define_method => NoMethodError
Module.new.public_class_method(:define_method)
Object.define_method => ArgumentError

Also of note, the same is not true when calling it on a class:

Object.define_method => NoMethodError
Class.new.public_class_method(:define_method)
Object.define_method => NoMethodError

which seems inconsistent given:

Module.new.singleton_class.ancestors => [Module, Object, Kernel, BasicObject]
Class.new.singleton_class.ancestors    => [Class, Module, Object, Kernel, BasicObject]


Is this a bug or expected behavior? If the latter, what is the correct explanation?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next