Project

General

Profile

Actions

Feature #13000

closed

Implement Set#include? with Hash#include?

Added by headius (Charles Nutter) over 7 years ago. Updated over 3 years ago.

Status:
Feedback
Target version:
-
[ruby-core:78467]
Tags:

Description

Why does Set#include? not call Hash#include?? Currently it calls Hash#[].

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

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0