Module: DRM::IoProcs

Defined in:
lib/drm/io_procs.rb

Class Method Summary collapse

Class Method Details

.read_proc(io) ⇒ Object

produces a read_proc(length, offset) for the given io instance of IO



3
4
5
6
7
8
# File 'lib/drm/io_procs.rb', line 3

def self.read_proc(io)
  Proc.new do |length, offset|
    io.seek offset
    io.read length
  end    
end

.write_proc(io) ⇒ Object

produces a write_proc(data) for the given io instance of IO



11
12
13
14
15
# File 'lib/drm/io_procs.rb', line 11

def self.write_proc(io)
  Proc.new do |data|
    io.write data
  end    
end