From: shevegen@... Date: 2017-11-28T16:23:02+00:00 Subject: [ruby-core:83926] [Ruby trunk Feature#14136] Implement #empty? on more classes Issue #14136 has been updated by shevegen (Robert A. Heiler). The issue discussion there is very long. For the purpose of this thread here, can you list which specific classes should have ".empty?()"? String, Array, Hash have this method so far. I can understand to some extent that Tempfile should have this behaviour. From the thread I see that you also want to include StringIO and File::Stat. I do not have any real particular contra opinion; neither do I have a particular pro opinion. I just would like to have this all in the thread here, for ease of discussion on MRI. (The rubocop discussion appears to be more akin to rubocop itself; whereas no MRI one ultimately has to convince matz and respectively the ruby core team). Also it may be useful to state why .empty? may be useful; I mean, I get the point of avoiding (.size == 0) checks but I think the MRI team also wants to know how frequent the usage is. ---------------------------------------- Feature #14136: Implement #empty? on more classes https://bugs.ruby-lang.org/issues/14136#change-67978 * Author: mikegee (Michael Gee) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Hi Ruby Friends! Rubocop prefers `#empty?` over `length == 0` and `size == 0`, which is great for `String`, `Array`, `Hash`, etc. It would be nice if more classes implemented `#empty?` for consistency. See related discussion at https://github.com/bbatsov/rubocop/issues/2841. I started this work at https://github.com/ruby/ruby/pull/1759 Thanks! -- https://bugs.ruby-lang.org/ Unsubscribe: