Sha256: 59d002cdac3afa4216ac8d6da4bbc570b53ce05e32c1511eda56f8dcd68aba37

Contents?: true

Size: 392 Bytes

Versions: 3

Compression:

Stored size: 392 Bytes

Contents

class String
  # A string is present if it's not a blank 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

3 entries across 3 versions & 1 rubygems

Version Path
ana-0.9.4 lib/ana/core_ext.rb
ana-0.9.3 lib/ana/core_ext.rb
ana-0.9.2 lib/ana/core_ext.rb