Sha256: e1483dba3c571d71942459255ebab57f3b836f80dde27d5126931937a1e9b6be

Contents?: true

Size: 353 Bytes

Versions: 5

Compression:

Stored size: 353 Bytes

Contents

require 'charlock_holmes'

module Estratto
  class Encoder
    attr_reader :content

    def initialize(content)
      @content = content
    end

    def encode
      CharlockHolmes::Converter.convert(content, encoding, 'UTF-8')
    end

    private

    def encoding
      CharlockHolmes::EncodingDetector.detect(content)[:encoding]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
estratto-1.0.5 lib/estratto/encoder.rb
estratto-1.0.4 lib/estratto/encoder.rb
estratto-1.0.3 lib/estratto/encoder.rb
estratto-1.0.2 lib/estratto/encoder.rb
estratto-1.0.1 lib/estratto/encoder.rb