Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/dirwatch/extensions/blank.rb,
lib/dirwatch/symbolize_extensions.rb
Instance Method Summary collapse
-
#blank? ⇒ Boolean
An object is blank if it’s false, empty, or a whitespace string.
-
#presence ⇒ Object
Returns the receiver if it’s present otherwise returns
nil. -
#present? ⇒ Boolean
An object is present if it’s not blank.
- #symbolize_keys ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
An object is blank if it’s false, empty, or a whitespace string. For example, false, ”, ‘ ’, nil, [], and {} are all blank.
4 5 6 |
# File 'lib/dirwatch/extensions/blank.rb', line 4 def blank? respond_to?(:empty?) ? !!empty? : !self end |
#presence ⇒ Object
Returns the receiver if it’s present otherwise returns nil.
14 15 16 |
# File 'lib/dirwatch/extensions/blank.rb', line 14 def presence self if present? end |
#present? ⇒ Boolean
An object is present if it’s not blank.
9 10 11 |
# File 'lib/dirwatch/extensions/blank.rb', line 9 def present? !blank? end |
#symbolize_keys ⇒ Object
2 3 4 |
# File 'lib/dirwatch/symbolize_extensions.rb', line 2 def symbolize_keys self end |