Browsing archives for 'Data'

Basic Ruby Idioms: Checking For An Empty String

Data, General 4 October 2009 | 0 Comments

Page 15 of The Ruby Way (2nd edition) presents a basic Ruby idiom for checking whether a string is empty or not.
I believe there are three ways to do it (if you can think of any others, leave a comment!). Two reasonably obvious, but one that’s quite idiomatic (the one that The Ruby Way mentions):

str.empty? [...]