Issue #13303 has been updated by shevegen (Robert A. Heiler).


Actually the name .nonempty? is easier to understand than .any? in this
context, or non-empty strings.

I think the only problem is that "nonempty" reads very ... strangely.

I can not come up with a good name either though.

  .non_empty?

May seem obvious but I am not sure either there since it is quite long.

I think that nonempty? or non_empty? is better than any? in this context
though.

Ignoring the ruby parser, I guess this here would be one of the shortest,
somewhat natural way to query and ask on an object:

  object, are you not empty

  object not empty?

I guess the most natural ruby way would still be 

  object.not_empty?
  object.non_empty?

Or perhaps we can ask any container/object if it has at least
one entry. :\

  object.at_the_least_one_entry?

The last one is a bit awful though - now .non_empty? or .non_empty?
or .not_empty? would look nicer. :)))

----------------------------------------
Feature #13303: String#any? as !String#empty?
https://bugs.ruby-lang.org/issues/13303#change-63765

* Author: naruse (Yui NARUSE)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
Once I proposed "some container#nonempty?" on #12075, and understand there's Array#any?.

Today I found String doesn't have such method.



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