Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/fluent/plugin/kubernetes_metadata_common.rb
Overview
copied from activesupport
Instance Method Summary collapse
-
#blank? ⇒ true, false
An object is blank if it’s false, empty, or a whitespace string.
-
#present? ⇒ true, false
An object is present if it’s not blank.
Instance Method Details
#blank? ⇒ true, false
An object is blank if it’s false, empty, or a whitespace string. For example, nil
, ”, ‘ ’, [], {}, and false
are all blank.
This simplifies
!address || address.empty?
to
address.blank?
129 130 131 |
# File 'lib/fluent/plugin/kubernetes_metadata_common.rb', line 129 def blank? respond_to?(:empty?) ? !!empty? : !self end |
#present? ⇒ true, false
An object is present if it’s not blank.
136 137 138 |
# File 'lib/fluent/plugin/kubernetes_metadata_common.rb', line 136 def present? !blank? end |