Class: Object

Inherits:
BasicObject
Defined in:
lib/dirwatch/extensions/blank.rb,
lib/dirwatch/symbolize_extensions.rb

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


4
5
6
# File 'lib/dirwatch/extensions/blank.rb', line 4

def blank?
  respond_to?(:empty?) ? !!empty? : !self
end

#presenceObject

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.

Returns:

  • (Boolean)


9
10
11
# File 'lib/dirwatch/extensions/blank.rb', line 9

def present?
  !blank?
end

#symbolize_keysObject



2
3
4
# File 'lib/dirwatch/symbolize_extensions.rb', line 2

def symbolize_keys
  self
end