From: MikkelFJ Date: 2003-04-02T07:48:53+09:00 Subject: Re: Newbie....ish - with questions! "Calum Shaw-Mackay" wrote in message news:BEEOLJOGDFLPOHNICOIEIEEFCAAA.calum.shaw-mackay@virgin.net... > mesgs = {} > .... # Fill a with mesgs > bitflags.each {|flag| puts mesgs[flag] if flag} > > Would this be going along the right lines? I haven't worked with binary operators in Ruby, but you seem to be on the right track. Certain you could have an integer, pick the lower bit, divide be 2. Repeat until integer is zero. For each bit you pick you call yield. For details on how to implement you own each function, see the PickAxe book - it has good examples. Sorry for not banging up the code, I just wanted to say that it would certainly be possible. There might be some bitvector packages around for Ruby I seem to recall Robert Feldt did something along those lines. Indeed doing a Google reveals http://www.ce.chalmers.se/~feldt/ruby/extensions/bitvector/ Mikkel