From: burdettelamar@... Date: 2020-12-21T21:34:24+00:00 Subject: [ruby-core:101610] [Ruby master Bug#17421] Enumerable uses overridden classes in examples Issue #17421 has been updated by burdettelamar@yahoo.com (Burdette Lamar). @jeremyevans0, I am not aware of any such, but have not checked. I am also not aware of any difference in the call-seqs for Enumerable and an overrider, buy have not checked. ---------------------------------------- Bug #17421: Enumerable uses overridden classes in examples https://bugs.ruby-lang.org/issues/17421#change-89397 * Author: burdettelamar@yahoo.com (Burdette Lamar) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Some method documentation in module Enumerable shows examples that cite overridden methods. For example, method #all? is overridden in Array, but all the #all? examples in Enumerable use Arrays: ``` %w[ant bear cat].all? { |word| word.length >= 3 } #=> true %w[ant bear cat].all? { |word| word.length >= 4 } #=> false %w[ant bear cat].all?(/t/) #=> false [1, 2i, 3.14].all?(Numeric) #=> true [nil, true, 99].all? #=> false [].all? #=> true ``` This is true of the doc for many methods in Enumerable. Here are the overriders I've found: all? Array any? Array Hash collect Array count Array Range cycle Array drop Array drop_while Array entries Range filter Array Struct Hash find_index Array first Array Range include? Array Range Hash Set map Array max Array Range member? Range Set Hash min Array Range minmax Array Range none? Array one? Array reject Array Hash reverse_each Array select Array Struct Hash sort Array sum Array take Array take_while Array to_a Array Struct Range Hash Set to_h Array Struct Hash to_set Set uniq Array zip Array So: - Should the Enumerable doc avoid these classes as appropriate? - Should the overriding methods be cited and linked? -- https://bugs.ruby-lang.org/ Unsubscribe: