Module: Tins::Blank::Object

Defined in:
lib/tins/xt/blank.rb

Overview

Blank behavior for Object instances

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Provides a fallback implementation that checks for ‘empty?` method, falling back to negation of truthiness if not defined.

Returns:

  • (Boolean)

    true if the object is considered blank, false otherwise



26
27
28
# File 'lib/tins/xt/blank.rb', line 26

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

#present?Boolean

Checks if the object is not blank

Returns:

  • (Boolean)

    true if the object is present, false otherwise



33
34
35
# File 'lib/tins/xt/blank.rb', line 33

def present?
  !blank?
end