Class: String
Direct Known Subclasses
Constant Summary collapse
- NON_WHITESPACE_REGEXP =
0x3000: fullwidth whitespace
%r![^\s#{[0x3000].pack("U")}]!
Instance Method Summary collapse
-
#blank? ⇒ Boolean
A string is blank if it’s empty or contains whitespaces only:.
- #encoding_aware? ⇒ Boolean
Instance Method Details
#blank? ⇒ Boolean
A string is blank if it’s empty or contains whitespaces only:
"".blank? # => true
" ".blank? # => true
" ".blank? # => true
" something here ".blank? # => false
111 112 113 114 115 116 117 118 |
# File 'lib/ext/object.rb', line 111 def blank? # 1.8 does not takes [:space:] properly if encoding_aware? self !~ /[^[:space:]]/ else self !~ NON_WHITESPACE_REGEXP end end |
#encoding_aware? ⇒ Boolean
92 93 94 |
# File 'lib/ext/object.rb', line 92 def encoding_aware? true end |