# class Mail::Encodings::TransferEncoding

### Constants

NAME
PRIORITY

### Public Class Methods

can_encode?(enc) click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 17
    def self.can_encode?(enc)
      can_transport? enc
    end

can_transport?(enc) click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 8
    def self.can_transport?(enc)
      enc = Encodings.get_name(enc)
      if Encodings.defined? enc
        Encodings.get_encoding(enc).new.is_a? self
      else
        false
      end
    end

cost(str) click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 21
    def self.cost(str)
      raise "Unimplemented"
    end

get_best_compatible(source_encoding, str) click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 29
    def self.get_best_compatible(source_encoding, str)
      if self.can_transport? source_encoding then
          source_encoding
      else
          choices = []
          Encodings.get_all.each do |enc|
              choices << enc if self.can_transport? enc and enc.can_encode? source_encoding
          end
          best = nil
          best_cost = 100
          choices.each do |enc|
              this_cost = enc.cost str
              if this_cost < best_cost then
                  best_cost = this_cost
                  best = enc
              elsif this_cost == best_cost then
                  best = enc if enc::PRIORITY < best::PRIORITY
              end
          end
          best
      end
    end

to_s() click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 25
    def self.to_s
      self::NAME
    end

### Public Instance Methods

to_s() click to toggle source

    # File lib/mail/encodings/transfer_encoding.rb, line 52
    def to_s
      self.class.to_s
    end