Module: Moc::Protocol::Type

Included in:
Integer, String, Symbol, Time
Defined in:
lib/moc/protocol.rb

Instance Method Summary collapse

Instance Method Details

#read(io) ⇒ Object



16
17
18
# File 'lib/moc/protocol.rb', line 16

def read (io)
	raise 'no read has been implemented'
end

#unpack(text, eat = false) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/moc/protocol.rb', line 20

def unpack (text, eat = false)
	io = StringIO.new(text)

	read(io).tap {
		text[0, io.tell] = '' if eat
	}
end