Module: CharlockHolmes::StringExt

Defined in:
lib/charlock_holmes/string.rb

Instance Method Summary collapse

Instance Method Details

#detect_encoding(hint = nil) ⇒ Object



5
6
7
# File 'lib/charlock_holmes/string.rb', line 5

def detect_encoding(hint=nil)
  EncodingDetector.detect(self, hint)
end

#detect_encoding!(hint = nil) ⇒ Object



13
14
15
16
17
# File 'lib/charlock_holmes/string.rb', line 13

def detect_encoding!(hint=nil)
  detected = EncodingDetector.detect(self, hint)
  self.force_encoding(detected[:encoding]) if detected[:encoding]
  self
end

#detect_encodings(hint = nil) ⇒ Object



9
10
11
# File 'lib/charlock_holmes/string.rb', line 9

def detect_encodings(hint=nil)
  EncodingDetector.detect_all(self, hint)
end