Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/mail/core_extensions/string.rb,
lib/mail/core_extensions/shellwords.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
- #ascii_only? ⇒ Boolean
- #not_ascii_only? ⇒ Boolean
-
#shellescape ⇒ Object
call-seq: str.shellescape => string.
- #to_crlf ⇒ Object
- #to_lf ⇒ Object
Instance Method Details
#ascii_only? ⇒ 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
20 21 22 |
# File 'lib/mail/core_extensions/string.rb', line 20 def not_ascii_only? !ascii_only? end |
#shellescape ⇒ Object
call-seq:
str.shellescape => string
Escapes str so that it can be safely used in a Bourne shell command line. See Shellwords::shellescape for details.
52 53 54 |
# File 'lib/mail/core_extensions/shellwords.rb', line 52 def shellescape Shellwords.escape(self) end |
#to_crlf ⇒ Object
3 4 5 |
# File 'lib/mail/core_extensions/string.rb', line 3 def to_crlf gsub(/\n|\r\n|\r/) { "\r\n" } end |
#to_lf ⇒ Object
7 8 9 |
# File 'lib/mail/core_extensions/string.rb', line 7 def to_lf gsub(/\n|\r\n|\r/) { "\n" } end |