Class: String
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
98 99 100 101 102 103 104 105 |
# File 'lib/tagged_logging/blank_ext.rb', line 98 def blank? # 1.8 does not takes [:space:] properly if encoding_aware? self !~ /[^[:space:]]/ else self !~ NON_WHITESPACE_REGEXP end end |
#encoding_aware? ⇒ Boolean
80 81 82 |
# File 'lib/tagged_logging/blank_ext.rb', line 80 def encoding_aware? true end |