Sha256: f4255c504ea97b0bab1ed79db0eac60d2e904fe38d80f8731ee59e692972b40f

Contents?: true

Size: 471 Bytes

Versions: 2

Compression:

Stored size: 471 Bytes

Contents

# encoding: UTF-8

# Mindfully expanding the base `Object` class with sensible methods.
class Object
  # An object is blank if it‘s false, empty, or a whitespace string. 
  # For example, "", " ", nil, [], and {} are blank.
  # 
  # @example This simplifies
  #   if !address.nil? && !address.empty?
  # @example to
  #   if !address.blank?
  # @see http://api.rubyonrails.org/classes/Object.html#M000279
  def blank?
    respond_to?(:empty?) ? empty? : !self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plow-1.0.1 lib/plow/core_ext/object.rb
plow-1.0.0 lib/plow/core_ext/object.rb