Class: Object

Inherits:
BasicObject
Defined in:
lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb

Overview

Check first to see if we are in a Rails environment, no need to define these methods if we are

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

An object is blank if it’s nil, empty, or a whitespace string. For example, “”, “ ”, nil, [], and {} are blank.

This simplifies

if !address.nil? && !address.empty?

to

if !address.blank?

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
# File 'lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb', line 19

def blank?
  if respond_to?(:empty?) && respond_to?(:strip)
    empty? or strip.empty?
  elsif respond_to?(:empty?)
    empty?
  else
    !self
  end
end