Sha256: 2ebf85417e7ff1e6ae1c05d2d7086b52dcd91266cdff91f73f7438a6eb97076a

Contents?: true

Size: 619 Bytes

Versions: 5

Compression:

Stored size: 619 Bytes

Contents

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

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

  unless String.instance_methods(false).map {|m| m.to_sym}.include?(:blank?)
    def blank?
      self !~ /\S/
    end
  end

  unless method_defined?(:ascii_only?)
    # Backport from Ruby 1.9 checks for non-us-ascii characters.
    def ascii_only?
      self !~ MATCH_NON_US_ASCII
    end

    MATCH_NON_US_ASCII = /[^\x00-\x7f]/
  end

  def not_ascii_only?
    !ascii_only?
  end

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

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
mail-2.5.5 lib/mail/core_extensions/string.rb
mail-2.5.5.rc1 lib/mail/core_extensions/string.rb
challah-1.0.0 vendor/bundle/gems/mail-2.5.4/lib/mail/core_extensions/string.rb
swipe-rails-0.0.5 vendor/bundle/gems/mail-2.5.4/lib/mail/core_extensions/string.rb
mail-2.5.4 lib/mail/core_extensions/string.rb