From: Joey Date: 2006-07-12T19:50:09+09:00 Subject: Re: ruby and byte ------=_Part_378_28901336.1152701406856 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline class Integer def bytes " "*self end end send(10.bytes) j`ey http://www.eachmapinject.com On 7/12/06, Pedro C=F4rte-Real wrote: > > On 7/12/06, Agnieszka Figiel wrote: > > How would you go about representing the byte type in Ruby? I have a tas= k > > where I neeed to be writing and reading bytes from a tcp socket - so fo= r > > instance I might want to send/receive an integer which is 1 byte long, > > other times 4 bytes. in Java you can do that easily with the byte type, > > so far I have no good idea how to do this in Ruby. > > Use a String. > > Pedro. > > ------=_Part_378_28901336.1152701406856--