Actions
Feature #13933
openAdd Range#empty?
Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
Description
Range already responds to #size. It would be nice if it also responded to predicate #empty? :-)
Updated by shevegen (Robert A. Heiler) over 5 years ago
Would be nice.
Updated by marcandre (Marc-Andre Lafortune) over 5 years ago
Note that Range#size
currently returns nil
for ranges of string, so it's not clear what empty?
would return for ranges of strings.
Updated by shan (Shannon Skipper) over 5 years ago
Range mixes in Enumerable so you can use #none?.
('a'..'b').none? #=> false
('b'..'a').none? #=> true
Updated by shevegen (Robert A. Heiler) over 5 years ago
I think the semantics between ".none?" is not the same as ".empty?". At
the least the latter appears to be more explicit to me.
But it's also not that important to me personally, I am fine either way. :-)
Actions
Like0
Like0Like0Like0Like0