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

Hello,

9 messages 2017/10/04

[ruby-core:83584] Re: [Ruby trunk Feature#14059] Refine multiple classes in one call

From: RRRoy BBBean <rrroybbbean@...>
Date: 2017-10-26 20:48:06 UTC
List: ruby-core #83584
On Thu, 2017-10-26 at 17:30 +0000, kevin.deisz@gmail.com wrote:
> Issue #14059 has been reported by kddeisz (Kevin Deisz).
> 
> ----------------------------------------
> Feature #14059: Refine multiple classes in one call
> https://bugs.ruby-lang.org/issues/14059
> 
> * Author: kddeisz (Kevin Deisz)
> * Status: Open
> * Priority: Normal
> * Assignee: 
> * Target version: 
> ----------------------------------------
> ...
> ~~~
> refine NilClass, Array, Hash do
>   def positive_integer?
>     false
>   end
> end
> ~~~
> 
> Is this something that people would consider? It seems like a good
> use case for refinements because I just want to send a message to an
> object, so basically I want a default case. I could just refine
> Object but that feels wrong, I'd rather get an undefined method
> exception so that I know something unexpected occurred. If accepted
> I'd be happy to submit a patch.

Yes. This is awesome and excellent. For curiosity, why not enclose the
classes in []?



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