Sha256: a106665768b926e4d65d5e51ea5081abc4507f7f73fd5ee4780b2d92b0fd5c56

Contents?: true

Size: 924 Bytes

Versions: 7

Compression:

Stored size: 924 Bytes

Contents

require 'mail'
require 'charlock_holmes'

Dir["#{__dir__}/jdec/**/*.rb"].each do |file|
  require file
end

module Mail
  module Jdec
    class << self
      attr_reader :enabled
      attr_accessor :autodetect_confidence
      attr_accessor :autodetect_skip_charsets
      attr_accessor :preferred_charsets

      def enabled?
        @@enabled
      end

      def enable
        @@enabled = true
      end

      def disable
        @@enabled = false
      end
    end

    self.enable
    self.autodetect_confidence = 50
    self.autodetect_skip_charsets = %w(utf-8 iso-8859-1)
    self.preferred_charsets = {
      'iso-2022-jp' => 'cp50221',
      'iso-2022-jp-1' => 'cp50221',
      'iso-2022-jp-2' => 'cp50221',
      'iso-2022-jp-3' => 'cp50221',
      'iso-2022-jp-2004' => 'cp50221',
      'shift_jis' => 'cp932',
      'shift-jis' => 'cp932',
      'x_sjis' => 'cp932',
      'x-sjis' => 'cp932'
    }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mail-jdec-1.0.6 lib/mail/jdec.rb
mail-jdec-1.0.5 lib/mail/jdec.rb
mail-jdec-1.0.4 lib/mail/jdec.rb
mail-jdec-1.0.3 lib/mail/jdec.rb
mail-jdec-1.0.2 lib/mail/jdec.rb
mail-jdec-1.0.1 lib/mail/jdec.rb
mail-jdec-1.0.0 lib/mail/jdec.rb