--L/Qt9NZ8t00Dhfad Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Shot (Piotr Szotkowski): > I=E2=80=99m trying to write an Enumerable#parallel method that, depending= on > a config option (retrieved inside it) would end up being an alias for > either Enumerable#map or Enumerable#forkoff. FWIW, the spec to pass is describe Enumerable do it 'should be able to process in parallel, depending on config option' do ArtDecomp::Config.processes =3D 1 pid1, pid2 =3D [1,2].parallel { Process.pid } pid1.should =3D=3D pid2 ArtDecomp::Config.processes =3D 2 pid1, pid2 =3D [1,2].parallel { Process.pid } pid1.should_not =3D=3D pid2 end end -- Shot --=20 E is for emacs, which rebinds your keys, and F is for fsck, which rebuilds your trees. G is for grep, a clever detective, while H is for halt, which may seem defective. --L/Qt9NZ8t00Dhfad Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFIMI5Pi/mCfdEo8UoRAlrmAKCOcUY4RZX5DAgrjtl8sByJLhvhJACg0taX rx7wWiIAa5UCE0EbxOY5X3I= =c38w -----END PGP SIGNATURE----- --L/Qt9NZ8t00Dhfad-- Shot (Piotr Szotkowski): > I¡Çm trying to write an Enumerable#parallel method that, dependingon > a config option (retrieved inside it) would end up being an alias for > either Enumerable#map or Enumerable#forkoff. FWIW, the spec to pass is describe Enumerable do it 'should be able to process in parallel, depending on config option' do ArtDecomp::Config.processes = 1 pid1, pid2 = [1,2].parallel { Process.pid } pid1.should == pid2 ArtDecomp::Config.processes = 2 pid1, pid2 = [1,2].parallel { Process.pid } pid1.should_not == pid2 end end -- Shot -- E is for emacs, which rebinds your keys, and F is for fsck, which rebuilds your trees. G is for grep, a clever detective, while H is for halt, which may seem defective. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFIMI5Pi/mCfdEo8UoRAlrmAKCOcUY4RZX5DAgrjtl8sByJLhvhJACg0taX rx7wWiIAa5UCE0EbxOY5X3I= =c38w -----END PGP SIGNATURE-----