Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mail/core_extensions/string.rb

Overview

:nodoc:

Constant Summary collapse

US_ASCII_REGEXP =

Provides all strings with the Ruby 1.9 method of .ascii_only? and returns true or false

%Q{\x00-\x7f}

Instance Method Summary collapse

Instance Method Details

#ascii_only?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/mail/core_extensions/string.rb', line 15

def ascii_only?
  !(self =~ /[^#{US_ASCII_REGEXP}]/)
end

#to_crlfObject



3
4
5
# File 'lib/mail/core_extensions/string.rb', line 3

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

#to_lfObject



7
8
9
# File 'lib/mail/core_extensions/string.rb', line 7

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