Sha256: 20bea037a6c8b2166f477e5124d00da04bdd43e8e7bdb72adcaf1f75dbcbd59a

Contents?: true

Size: 471 Bytes

Versions: 4

Compression:

Stored size: 471 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

  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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mail-2.1.5.3 lib/mail/core_extensions/string.rb
mail-2.1.5.2 lib/mail/core_extensions/string.rb
mail-2.1.5.1 lib/mail/core_extensions/string.rb
mail-2.1.5 lib/mail/core_extensions/string.rb