File: identity.rb

package info (click to toggle)
ruby-mail 2.8.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,704 kB
  • sloc: ruby: 73,709; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/transfer_encoding'

module Mail
  module Encodings
    # Identity encodings do no encoding/decoding and have a fixed cost:
    # 1 byte in -> 1 byte out.
    class Identity < TransferEncoding #:nodoc:
      def self.decode(str)
        str
      end

      def self.encode(str)
        str
      end

      # 1 output byte per input byte.
      def self.cost(str)
        1.0
      end
    end
  end
end