Class: Mail::Encodings::SevenBit

Inherits:
EightBit show all
Defined in:
lib/mail/encodings/7bit.rb

Overview

7bit and 8bit are equivalent. 7bit encoding is for text only.

Direct Known Subclasses

Base64, QuotedPrintable

Constant Summary collapse

NAME =
'7bit'
PRIORITY =
1

Class Method Summary collapse

Methods inherited from Identity

cost

Methods inherited from TransferEncoding

can_encode?, can_transport?, cost, lowest_cost, negotiate, renegotiate, to_s

Class Method Details

.compatible_input?(str) ⇒ Boolean

Per RFC 2045 2.7. 7bit Data, No octets with decimal values greater than 127 are allowed.

Returns:

  • (Boolean)


22
23
24
# File 'lib/mail/encodings/7bit.rb', line 22

def self.compatible_input?(str)
  str.ascii_only? && super
end

.decode(str) ⇒ Object



13
14
15
# File 'lib/mail/encodings/7bit.rb', line 13

def self.decode(str)
  ::Mail::Utilities.binary_unsafe_to_lf str
end

.encode(str) ⇒ Object



17
18
19
# File 'lib/mail/encodings/7bit.rb', line 17

def self.encode(str)
  ::Mail::Utilities.binary_unsafe_to_crlf str
end