Method: Asciify#initialize

Defined in:
lib/asciify.rb

#initialize(replacement = "?", target = "ASCII", source = "UTF-8") ⇒ Asciify

Returns a new instance of Asciify.



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/asciify.rb', line 65

def initialize(replacement = "?", target = "ASCII", source = "UTF-8")
  @from_input_enc = Iconv.new(Intermediate, source)
  @to_output_enc = Iconv.new(target, Intermediate)

  if String === replacement
    r = @from_input_enc.iconv(replacement).unpack(PackFormat)
    @mapping = Hash.new(r)
  else
    @mapping = replacement
  end
end