Class: Hanami::Utils::Blank Private
- Inherits:
-
Object
- Object
- Hanami::Utils::Blank
- Defined in:
- lib/hanami/utils/blank.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Checks for blank
Constant Summary collapse
- STRING_MATCHER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Matcher for blank strings
/\A[[:space:]]*\z/
Class Method Summary collapse
-
.blank?(object) ⇒ TrueClass, FalseClass
private
Checks object is blank.
-
.filled?(object) ⇒ TrueClass, FalseClass
private
Checks object is filled.
Class Method Details
.blank?(object) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks object is blank
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hanami/utils/blank.rb', line 32 def self.blank?(object) # rubocop:disable Metrics/MethodLength case object when String, ::String STRING_MATCHER === object # rubocop:disable Style/CaseEquality when Hash, ::Hash, ::Array object.empty? when TrueClass, Numeric false when FalseClass, NilClass true else object.respond_to?(:empty?) ? object.empty? : !self end end |
.filled?(object) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks object is filled
65 66 67 |
# File 'lib/hanami/utils/blank.rb', line 65 def self.filled?(object) !blank?(object) end |