Class: Box::Packer

Inherits:
Object
  • Object
show all
Defined in:
lib/box/packer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePacker

Returns a new instance of Packer.



6
7
# File 'lib/box/packer.rb', line 6

def initialize
end

Class Method Details

.pack(data) ⇒ Object



9
10
11
12
13
14
# File 'lib/box/packer.rb', line 9

def self.pack(data)
	c = Zlib::Deflate.deflate(data)
	e = Base64.encode64(c)

	return e
end

.unpack(data) ⇒ Object



15
16
17
18
19
20
# File 'lib/box/packer.rb', line 15

def self.unpack(data)
	e = Base64.decode64(data)
	c = Zlib::Inflate.inflate(e)

	return c
end