Method: GPGME::IOCallbacks#write

Defined in:
lib/gpgme/io_callbacks.rb

#write(hook, buffer, length) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/gpgme/io_callbacks.rb', line 11

def write(hook, buffer, length)
  data = buffer[0 .. length]
  # Handle encoding conversion if the IO has a different encoding
  if @io.respond_to?(:external_encoding) && @io.external_encoding
    data = data.encode(@io.external_encoding, invalid: :replace, undef: :replace)
  end
  @io.write(data)
end