Sha256: 346149786f360f379cab19736bdb33d9d1c39753b37390bb6f62f6e5ea7fae41

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

# encoding: utf-8
class String #:nodoc:
  def to_crlf
    gsub(/\n|\r\n|\r/) { "\r\n" }
  end

  def to_lf
    gsub(/\n|\r\n|\r/) { "\n" }
  end

  def blank?
    self !~ /\S/
  end

  unless method_defined?(:ascii_only?)
    # Provides all strings with the Ruby 1.9 method of .ascii_only? and
    # returns true or false
    US_ASCII_REGEXP = %Q{\x00-\x7f}
    def ascii_only?
      !(self =~ /[^#{US_ASCII_REGEXP}]/)
    end
  end

  def not_ascii_only?
    !ascii_only?
  end

  unless method_defined?(:bytesize)
    alias :bytesize :length
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
mail-2.3.3 lib/mail/core_extensions/string.rb
mail-2.3.2 lib/mail/core_extensions/string.rb
mail-trunk-2.3.0 lib/mail/core_extensions/string.rb
mail-2.3.0 lib/mail/core_extensions/string.rb