Sha256: 2a8a4ea37f5dce2b43755f5e9c4df3b8fe3d079ebee6ba411dd2cae26894d127

Contents?: true

Size: 340 Bytes

Versions: 2

Compression:

Stored size: 340 Bytes

Contents

class String
  def present?
    !blank?
  end

  # A string is blank if it's empty or contains whitespaces only:
  #
  #   ''.blank?                 # => true
  #   '   '.blank?              # => true
  #   ' '.blank?               # => true
  #   ' something here '.blank? # => false
  def blank?
    self =~ /\A[[:space:]]*\z/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ana-0.9.1 lib/ana/core_ext.rb
ana-0.9.0 lib/ana/core_ext.rb