module ACSV::Detect::EncodingHolmes

Constants

DEFAULT_CONFIDENCE

Public Class Methods

encoding(data, options) click to toggle source
# File lib/acsv/detect/encoding_holmes.rb, line 20
def self.encoding(data, options)
  if present?
    encdet = ::CharlockHolmes::EncodingDetector.detect(data)
    encdet[:encoding] if encdet[:confidence] > (options[:confidence] || DEFAULT_CONFIDENCE)*100
  end
end
present?() click to toggle source
# File lib/acsv/detect/encoding_holmes.rb, line 16
def self.present?
  defined? ::CharlockHolmes::EncodingDetector
end
require_name() click to toggle source
# File lib/acsv/detect/encoding_holmes.rb, line 12
def self.require_name
  'charlock_holmes'
end