Issue #6515 has been updated by lellisga (Li Ellis Galardo).


Sorry but i'm not sure what you are asking. In other words you really think it's easier to do this:


a = [1,2,3,4,5,6,7].to_set
 => #<Set: {1, 2, 3, 4, 5, 6, 7}> 
b = [1,2,3].to_set
 => #<Set: {1, 2, 3}> 
b.subset? a
 => true 

If you answer is yes, then we are doing this wrong because subset? or part_of method should be in a parent class (maybe Enumerable class ) in order for it to work for subset, array, hash and any data structure that inherit from it Enumerable.

There's a difference between subset and arrays isn't it? they should have different methods, eventually some of them will work for subset just as they work for arrays.
----------------------------------------
Feature #6515: array.c: added method that verifies if an Array is part of another
https://bugs.ruby-lang.org/issues/6515#change-27003

Author: lellisga (Li Ellis Galardo)
Status: Feedback
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: 2.0.0


This method is like the include? method but instead of receiving a value and check if the array has it, it receives an array an check if it's part of another one.

https://github.com/ruby/ruby/pull/127


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