Method: FileOverwrite#force_encoding

Defined in:
lib/file_overwrite.rb

#force_encoding(enc) ⇒ Encoding

Implement String#force_encoding

Once this is called, @ext_enc_old is overwritten (or set), and it remains so even after reset() is called.



263
264
265
266
267
268
269
270
271
272
# File 'lib/file_overwrite.rb', line 263

def force_encoding(enc)
  @ext_enc_old = enc  # raises an Exception if called after "completed"
  return enc if @is_edit_finished || fresh?
  return @outstr.force_encoding(enc) if @outstr
  if @outary
    @outary.map!{|i| i.force_encoding(enc)}
    return enc
  end
  raise 'Should not happen.  Contact the code developer.'
end