G_ F_ wrote:
> On Oct 30, 4:11am, Bertram Scharpf <li... / bertram-scharpf.de> wrote:
> [...]
>> By the way: Still I'm convinced that there should be a
>> `String#notempty?' method corresponding to `Numeric#nonzero?'.
>>
>> Bertram
>>
>> --
>> Bertram Scharpf
>> Stuttgart, Deutschland/Germanyhttp://www.bertram-scharpf.de
> 
> Maybe I'm totally missing the point here, 

You are.

> but I thought String.any?
> was good enough to tell whether a string has contents:
> 
> 'asdf'.any? # => true
> ''.any? # => false
> 
> 'asdf'.empty? # => false
> ''.empty? # => true

No. Bertram's idea was a bit different as far as I can tell.  I think he 
was saying that just as we have
5.nonzero? # => 5
we should have
'foo'.notempty? # => 'foo'

I think it's a good idea, but since it's so trivial to implement, I 
doubt that it needs to be a core extension.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org


-- 
Posted via http://www.ruby-forum.com/.