Class: String

Inherits:
Object show all
Defined in:
lib/croesus/core_ext/blank.rb

Overview

Add #blank? method to String class.

Instance Method Summary collapse

Instance Method Details

#blank?TrueClass, FalseClass

Strips out whitespace then tests if the string is empty.

"".blank?         #=>  true
"     ".blank?    #=>  true
" hey ho ".blank? #=>  false

Returns:



105
106
107
# File 'lib/croesus/core_ext/blank.rb', line 105

def blank?
  strip.empty?
end