Module: CharlockHolmes::Converter

Extended by:
Converter
Included in:
Converter
Defined in:
lib/charlock_holmes/converter.rb

Instance Method Summary collapse

Instance Method Details

#convert(string, from, to) ⇒ Object

Raises:

  • (TypeError)


5
6
7
8
9
10
# File 'lib/charlock_holmes/converter.rb', line 5

def convert(string, from, to)
  raise TypeError.new("string cannot be nil") unless string
  raise TypeError.new("from cannot be nil") unless from
  raise TypeError.new("to cannot be nil") unless to
  string.encode(to, from)
end