From: "Shot (Piotr Szotkowski)" Date: 2008-05-22T02:08:14+09:00 Subject: Re: How to wrap either forkoff or map depending on a config variable? --AH+kv8CCoFf6qPuz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Shot (Piotr Szotkowski): > module Enumerable > def parallel &block > case ArtDecomp::Config.processes > when 1 then map &block > else forkoff ArtDecomp::Config.processes, &block > end > end > end > How would I implement the above using block_given? + yield? It seems the below works: module Enumerable def parallel case ArtDecomp::Config.processes when 1 then map { yield } else forkoff ArtDecomp::Config.processes { yield } end end end -- Shot --=20 If I ever saw an animated penguin with a speech bubble saying, "It looks like you're trying to edit fstab," I'd switch to BSD faster than a speeding Gentoo user. -- Paul Hudson --AH+kv8CCoFf6qPuz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFINFiRi/mCfdEo8UoRAqj0AJ42mW083Ppngkeuvob32qiKTkRo2ACfRTvn lbaVKtWUZnanQ/6guJXXA/4= =ogCx -----END PGP SIGNATURE----- --AH+kv8CCoFf6qPuz--