<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Playing with blocks : Part 1</title>
	<link>http://www.rubyfleebie.com/playing-with-blocks-part-1/</link>
	<description>Because programming should be fun</description>
	<pubDate>Tue, 16 Mar 2010 23:14:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>

	<item>
		<title>By: rx</title>
		<link>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-227</link>
		<author>rx</author>
		<pubDate>Mon, 28 May 2007 22:34:19 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-227</guid>
					<description>your second example, given as 

&#62; 1. my_block = Proc.new {&#124;item&#124; puts item}
&#62; 2. the_array.each(my_block)

would fail, right. fix that by adding a `&#38;' to the call parameter:

2. the_array.each( &#38;my_block )
                                ^

using this syntax, you actually _can_ foist Proc objects on methods expecting only raw blocks.

...the pickaxe is your friend. ;-)</description>
		<content:encoded><![CDATA[<p>your second example, given as </p>
<p>&gt; 1. my_block = Proc.new {|item| puts item}<br />
&gt; 2. the_array.each(my_block)</p>
<p>would fail, right. fix that by adding a `&amp;&#8217; to the call parameter:</p>
<p>2. the_array.each( &amp;my_block )<br />
                                ^</p>
<p>using this syntax, you actually _can_ foist Proc objects on methods expecting only raw blocks.</p>
<p>&#8230;the pickaxe is your friend. <img src='http://www.rubyfleebie.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Morning Brew #15</title>
		<link>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-228</link>
		<author>Morning Brew #15</author>
		<pubDate>Tue, 29 May 2007 11:01:55 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-228</guid>
					<description>[...] Playing with blocks : Part 1 [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Playing with blocks : Part 1 [&#8230;]</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Shadowfiend</title>
		<link>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-229</link>
		<author>Shadowfiend</author>
		<pubDate>Wed, 30 May 2007 17:32:18 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-229</guid>
					<description>I believe in order to pass a block as an &#38;-prefixed parameter, you have to prefix it with an &#38;, as well. So:

@greasy_food_you_eat_on_fridays.each(code_block)

Would instead be:

@greasy_food_you_eat_on_fridays.each(&#38;code_block)

Moreover, you should still be able to use yield in those situations. You should also be able to use block_given? in either situation instead of comparing to nil, which I find clearer.

Nice post :-)</description>
		<content:encoded><![CDATA[<p>I believe in order to pass a block as an &amp;-prefixed parameter, you have to prefix it with an &amp;, as well. So:</p>
<p>@greasy_food_you_eat_on_fridays.each(code_block)</p>
<p>Would instead be:</p>
<p>@greasy_food_you_eat_on_fridays.each(&amp;code_block)</p>
<p>Moreover, you should still be able to use yield in those situations. You should also be able to use block_given? in either situation instead of comparing to nil, which I find clearer.</p>
<p>Nice post <img src='http://www.rubyfleebie.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-230</link>
		<author>Frank</author>
		<pubDate>Wed, 30 May 2007 22:08:16 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/playing-with-blocks-part-1/#comment-230</guid>
					<description>rx and Shadowfiend,

You're both right! I'm going to update the original post about that.

rx, sorry. I don't know why your comment got marked as spam by Askimet.</description>
		<content:encoded><![CDATA[<p>rx and Shadowfiend,</p>
<p>You&#8217;re both right! I&#8217;m going to update the original post about that.</p>
<p>rx, sorry. I don&#8217;t know why your comment got marked as spam by Askimet.</p>
]]></content:encoded>
				</item>
</channel>
</rss>
