Module: Prmd::Utils
- Defined in:
- lib/prmd/utils.rb
Overview
For any tid bits, or core extension methods, without the “core” extension
Constant Summary collapse
- BLANK_REGEX =
For checking if the string contains only spaces
/\A\s+\z/
Class Method Summary collapse
Class Method Details
.blank?(obj) ⇒ Boolean
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prmd/utils.rb', line 7 def self.blank?(obj) if obj.nil? true elsif obj.is_a?(String) obj.empty? || !!(obj =~ BLANK_REGEX) elsif obj.respond_to?(:empty?) obj.empty? else false end end |