Module: ODBA::Marshal

Defined in:
lib/odba/marshal.rb

Overview

Marshal is a simple extension of ::Marshal. To be able to store our data using the DBI-Interface, we need to escape invalid characters from the standard binary dump.

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object



9
10
11
12
# File 'lib/odba/marshal.rb', line 9

def Marshal.dump(obj)
	binary = ::Marshal.dump(obj)
	binary.unpack('H*').first
end

.load(hexdump) ⇒ Object



13
14
15
16
# File 'lib/odba/marshal.rb', line 13

def Marshal.load(hexdump)
	binary = [hexdump].pack('H*')
	::Marshal.load(binary)
end