ruby-core

Mailing list archive

[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>

Currently, ruby/spec is maintained mostly by individuals and enjoys the

13 messages 2016/12/13

[ruby-core:78467] [Ruby trunk Bug#13000] Implement Set#include? with Hash#include?

From: headius@...
Date: 2016-12-02 16:25:39 UTC
List: ruby-core #78467
Issue #13000 has been reported by Charles Nutter.

----------------------------------------
Bug #13000: Implement Set#include? with Hash#include?
https://bugs.ruby-lang.org/issues/13000

* Author: Charles Nutter
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Why does `Set#include?` not call `Hash#include?`? Currently it calls `Hash#[]`.

The protocol of Set already use `Hash#include?` for `==`.

```diff
diff --git a/lib/set.rb b/lib/set.rb
index 43c388c..f3dbe2d 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -230,7 +230,7 @@ def flatten!
   #
   # See also Enumerable#include?
   def include?(o)
-    @hash[o]
+    @hash.include?(o)
   end
   alias member? include?
 
```







-- 
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