Class: Mail::Encodings::EightBit

Inherits:
Binary show all
Defined in:
lib/mail/encodings/8bit.rb

Direct Known Subclasses

SevenBit

Constant Summary

NAME =
'8bit'
PRIORITY =
4

Class Method Summary collapse

Methods inherited from TransferEncoding

can_encode?, can_transport?, get_best_compatible, to_s, #to_s

Class Method Details

.compatible_input?(str) ⇒ Boolean

Per RFC 2821 4.5.3.1, SMTP lines may not be longer than 1000 octets including the <CRLF>.



29
30
31
# File 'lib/mail/encodings/8bit.rb', line 29

def self.compatible_input?(str)
  !str.lines.find { |line| line.length > 998 }
end

.cost(str) ⇒ Object

Idenity encodings have a fixed cost, 1 byte out per 1 byte in



24
25
26
# File 'lib/mail/encodings/8bit.rb', line 24

def self.cost(str)
  1.0
end

.decode(str) ⇒ Object

Decode the string



14
15
16
# File 'lib/mail/encodings/8bit.rb', line 14

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

.encode(str) ⇒ Object

Encode the string



19
20
21
# File 'lib/mail/encodings/8bit.rb', line 19

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