Class: GPGME::IOCallbacks

Inherits:
Object
  • Object
show all
Defined in:
lib/gpgme/io_callbacks.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ IOCallbacks

Returns a new instance of IOCallbacks.



3
4
5
# File 'lib/gpgme/io_callbacks.rb', line 3

def initialize(io)
  @io = io
end

Instance Method Details

#read(hook, length) ⇒ Object



7
8
9
# File 'lib/gpgme/io_callbacks.rb', line 7

def read(hook, length)
  @io.read(length)
end

#seek(hook, offset, whence) ⇒ Object



15
16
17
18
19
# File 'lib/gpgme/io_callbacks.rb', line 15

def seek(hook, offset, whence)
  return @io.pos if offset == 0 && whence == IO::SEEK_CUR
  @io.seek(offset, whence)
  @io.pos
end

#write(hook, buffer, length) ⇒ Object



11
12
13
# File 'lib/gpgme/io_callbacks.rb', line 11

def write(hook, buffer, length)
  @io.write(buffer[0 .. length])
end