Method: MemoryIO::Process#write

Defined in:
lib/memory_io/process.rb

#write(addr, objects, **options) ⇒ void

This method returns an undefined value.

Write objects at addr.

This method has almost same arguments as IO#write.

Examples:

process = MemoryIO.attach('self')
s = 'A' * 16
process.write(s.object_id * 2 + 16, 'BBBBCCCC')
s
#=> 'BBBBCCCCAAAAAAAA'

Parameters:

  • addr (Integer, String)

    The address to start to write. See examples.

  • objects (Object, Array<Object>)

    Objects to write. If objects is an array, the write procedure will be invoked objects.size times.

See Also:



130
131
132
# File 'lib/memory_io/process.rb', line 130

def write(addr, objects, **options)
  mem_io(:write) { |io| io.write(objects, from: MemoryIO::Util.safe_eval(addr, bases), **options) }
end