There is no such function in Ruby, but is there an active suggestion for String#blank? in ruby-core .
In the meantime, you can use this implementation:
class String def blank? !include?(/[^[:space:]]/) end end
This implementation will be very effective even for very long lines.
source share