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

#not_ascii_only?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mail/core_extensions/string.rb', line 20

def not_ascii_only?
  !ascii_only?
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