<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 10 Ruby programming tips you should already know</title>
	<atom:link href="http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/</link>
	<description>blog pe cale de disparitie</description>
	<lastBuildDate>Sun, 14 Mar 2010 22:17:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Andrei Maxim</title>
		<link>http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/comment-page-1/#comment-6955</link>
		<dc:creator>Andrei Maxim</dc:creator>
		<pubDate>Sat, 05 Jul 2008 13:59:59 +0000</pubDate>
		<guid isPermaLink="false">http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/#comment-6955</guid>
		<description>Why mess around with Date (that&#039;s not in Ruby core) and not with Time? You basically get the same benefits, especially if you&#039;re using Rails with simpler objects:

&lt;code&gt;
&gt;&gt; a = Time.utc(2008, 2, 1)
=&gt; Fri Feb 01 00:00:00 UTC 2008
&gt;&gt; a.beginning_of_month
=&gt; Fri Feb 01 00:00:00 UTC 2008
&gt;&gt; a.end_of_month
=&gt; Fri Feb 29 00:00:00 UTC 2008
&gt;&gt; a.strftime(&quot;%d-%m-%Y&quot;)
=&gt; &quot;01-02-2008&quot;
&gt;&gt; a.to_date
=&gt; #
&lt;/code&gt;

There is a whole discussion regarding what&#039;s standard in Ruby because it&#039;s no default way to convert from a Time object to a Date object (although Rails has Time#to_date and Date#to_time methods). I personally prefer Time#utc or Time#local because it&#039;s a bit more descriptive than Date#civil (although it relies on the underlying system date functions and might be limited in some ways). Why not Date#commercial?</description>
		<content:encoded><![CDATA[<p>Why mess around with Date (that&#8217;s not in Ruby core) and not with Time? You basically get the same benefits, especially if you&#8217;re using Rails with simpler objects:</p>
<p><code><br />
&gt;&gt; a = Time.utc(2008, 2, 1)<br />
=&gt; Fri Feb 01 00:00:00 UTC 2008<br />
&gt;&gt; a.beginning_of_month<br />
=&gt; Fri Feb 01 00:00:00 UTC 2008<br />
&gt;&gt; a.end_of_month<br />
=&gt; Fri Feb 29 00:00:00 UTC 2008<br />
&gt;&gt; a.strftime("%d-%m-%Y")<br />
=&gt; "01-02-2008"<br />
&gt;&gt; a.to_date<br />
=&gt; #<br />
</code></p>
<p>There is a whole discussion regarding what&#8217;s standard in Ruby because it&#8217;s no default way to convert from a Time object to a Date object (although Rails has Time#to_date and Date#to_time methods). I personally prefer Time#utc or Time#local because it&#8217;s a bit more descriptive than Date#civil (although it relies on the underlying system date functions and might be limited in some ways). Why not Date#commercial?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/comment-page-1/#comment-6937</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 02 Jul 2008 17:02:26 +0000</pubDate>
		<guid isPermaLink="false">http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/#comment-6937</guid>
		<description>thanks for the link

i already blogged about enumerable http://alexbrie.net/1787/enumerable-iterators-why-i-love-ruby-part-2/, now  i just wanted to emphasize inject&#039;s cool properties in making your code smaller and cleaner</description>
		<content:encoded><![CDATA[<p>thanks for the link</p>
<p>i already blogged about enumerable <a href="http://alexbrie.net/1787/enumerable-iterators-why-i-love-ruby-part-2/" rel="nofollow">http://alexbrie.net/1787/enumerable-iterators-why-i-love-ruby-part-2/</a>, now  i just wanted to emphasize inject&#8217;s cool properties in making your code smaller and cleaner</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piku</title>
		<link>http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/comment-page-1/#comment-6936</link>
		<dc:creator>Piku</dc:creator>
		<pubDate>Wed, 02 Jul 2008 16:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://alexbrie.net/2002/10-ruby-programming-tips-you-should-already-know/#comment-6936</guid>
		<description>More interesting goodies: http://matthewcarriere.com/2008/6/23/using-select-reject-collect-inject-and-detect
Collect and inject basically are map and reduce.</description>
		<content:encoded><![CDATA[<p>More interesting goodies: <a href="http://matthewcarriere.com/2008/6/23/using-select-reject-collect-inject-and-detect" rel="nofollow">http://matthewcarriere.com/2008/6/23/using-select-reject-collect-inject-and-detect</a><br />
Collect and inject basically are map and reduce.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
