Module: Specjour::Protocol

Included in:
Connection, Printer, Worker
Defined in:
lib/specjour/protocol.rb

Constant Summary collapse

TERMINATOR =
"|ruojceps|"
TERMINATOR_REGEXP =
/#{TERMINATOR}$/

Instance Method Summary collapse

Instance Method Details

#dump_object(data) ⇒ Object



6
7
8
# File 'lib/specjour/protocol.rb', line 6

def dump_object(data)
  Marshal.dump(data) << TERMINATOR
end

#load_object(data) ⇒ Object



10
11
12
# File 'lib/specjour/protocol.rb', line 10

def load_object(data)
  Marshal.load(data.sub(TERMINATOR_REGEXP, ''))
end