<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: map_by_method - the final announcement</title>
	<atom:link href="http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<pubDate>Sun, 20 Jul 2008 11:39:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56974</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Fri, 16 Nov 2007 03:44:02 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56974</guid>
		<description>@lawrencepit [&lt;a href='http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56779' rel="nofollow"&gt;via&lt;/a&gt;] - ooh nice one. v0.8.3 released.

Here are the unit tests I added:

&lt;pre&gt;
  def test_pass_args
    original = ["hello world", "hallo wereld", "ciao mondo"]
    expected = %w[hell hall ciao]
    assert_equal(expected, original.map_by_slice(0,4))
  end
  
  def test_pass_block
    original = ["hello world", "hallo wereld", "ciao mondo"]
    expected = ["[hello ]world", "[hallo ]wereld", "[ciao ]mondo"]
    assert_equal(expected, original.map_by_gsub(/^(.*)\s/) {&#124;first_word&#124; "[#{first_word}]" })
  end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@lawrencepit [<a href='http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56779' rel="nofollow">via</a>] - ooh nice one. v0.8.3 released.</p>
<p>Here are the unit tests I added:</p>
<pre>
  def test_pass_args
    original = ["hello world", "hallo wereld", "ciao mondo"]
    expected = %w[hell hall ciao]
    assert_equal(expected, original.map_by_slice(0,4))
  end

  def test_pass_block
    original = ["hello world", "hallo wereld", "ciao mondo"]
    expected = ["[hello ]world&#8221;, &#8220;[hallo ]wereld&#8221;, &#8220;[ciao ]mondo&#8221;]
    assert_equal(expected, original.map_by_gsub(/^(.*)\s/) {|first_word| &#8220;[#{first_word}]&#8221; })
  end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: lawrencepit</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56779</link>
		<dc:creator>lawrencepit</dc:creator>
		<pubDate>Thu, 15 Nov 2007 05:16:43 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-56779</guid>
		<description>Dear Dr Nic,

Is there a particular reason why you don't pass the arguments and block magic to the mapped method? For more fun I modified line 33 to:
  
  self.send(iterator) { &#124;item&#124; item.send(method, *args, &#38;block) }

and ran these tests:

  require 'map_by_method'
  a = ["hello world", "hallo wereld", "ciao mondo"]
  puts a.map_by_capitalize
  puts a.map_by_center(30)
  a.map_by_scan(/^(.*)\s(.*)$/) {&#124;x,y&#124; print y, ".", x, " -- " }

which outputs:

  Hello world
  Hallo wereld
  Ciao mondo
           hello world
           hallo wereld
            ciao mondo
  world.hello -- wereld.hallo -- mondo.ciao --

performance wise this gem works pretty well. Much nicer magic this compared to Symbol#to_proc. :-)


Best regards,
Lawrence Pit</description>
		<content:encoded><![CDATA[<p>Dear Dr Nic,</p>
<p>Is there a particular reason why you don&#8217;t pass the arguments and block magic to the mapped method? For more fun I modified line 33 to:</p>
<p>  self.send(iterator) { |item| item.send(method, *args, &amp;block) }</p>
<p>and ran these tests:</p>
<p>  require &#8216;map_by_method&#8217;<br />
  a = ["hello world", "hallo wereld", "ciao mondo"]<br />
  puts a.map_by_capitalize<br />
  puts a.map_by_center(30)<br />
  a.map_by_scan(/^(.*)\s(.*)$/) {|x,y| print y, &#8220;.&#8221;, x, &#8221; &#8212; &#8221; }</p>
<p>which outputs:</p>
<p>  Hello world<br />
  Hallo wereld<br />
  Ciao mondo<br />
           hello world<br />
           hallo wereld<br />
            ciao mondo<br />
  world.hello &#8212; wereld.hallo &#8212; mondo.ciao &#8211;</p>
<p>performance wise this gem works pretty well. Much nicer magic this compared to Symbol#to_proc. <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Best regards,<br />
Lawrence Pit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruby Galore - Today Top Blog Posts on Ruby on Rails - Powered by SocialRank</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-48146</link>
		<dc:creator>Ruby Galore - Today Top Blog Posts on Ruby on Rails - Powered by SocialRank</dc:creator>
		<pubDate>Tue, 09 Oct 2007 08:02:28 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-48146</guid>
		<description>[...] map_by_method - the final announcement [...]</description>
		<content:encoded><![CDATA[<p>[...] map_by_method - the final announcement [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45175</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Sun, 09 Sep 2007 07:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45175</guid>
		<description>@chris - nay, my clever intercontinental colleague, it is a contribution or collaboration, rather than a corruption or conspiracy.</description>
		<content:encoded><![CDATA[<p>@chris - nay, my clever intercontinental colleague, it is a contribution or collaboration, rather than a corruption or conspiracy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45173</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Sun, 09 Sep 2007 07:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45173</guid>
		<description>@dem - sounds like a rubygems issue. If it continues, try uninstalling all copies of the gem, and reinstalling. If that fails, try checking the rubygems mailing lists.</description>
		<content:encoded><![CDATA[<p>@dem - sounds like a rubygems issue. If it continues, try uninstalling all copies of the gem, and reinstalling. If that fails, try checking the rubygems mailing lists.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: clem</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45130</link>
		<dc:creator>clem</dc:creator>
		<pubDate>Sat, 08 Sep 2007 15:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45130</guid>
		<description>Trying to gem update map_by_method to 0,8.2 is throwing a zlib::buferror on my winsuck machine.</description>
		<content:encoded><![CDATA[<p>Trying to gem update map_by_method to 0,8.2 is throwing a zlib::buferror on my winsuck machine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45102</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sat, 08 Sep 2007 00:11:30 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/07/map_by_method-the-final-announcement/#comment-45102</guid>
		<description>You're gonna steal my schtick?  I see how it is.</description>
		<content:encoded><![CDATA[<p>You&#8217;re gonna steal my schtick?  I see how it is.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
