<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cashplk的心路历程 &#187; ruby 习惯</title>
	<atom:link href="http://cashplk.com/tag/ruby-%e4%b9%a0%e6%83%af/feed/" rel="self" type="application/rss+xml" />
	<link>http://cashplk.com</link>
	<description>学无止境，梦如夏花～</description>
	<lastBuildDate>Sat, 31 Jul 2010 10:15:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ruby惯用写法</title>
		<link>http://cashplk.com/2009/05/23/ruby%e6%83%af%e7%94%a8%e5%86%99%e6%b3%95/</link>
		<comments>http://cashplk.com/2009/05/23/ruby%e6%83%af%e7%94%a8%e5%86%99%e6%b3%95/#comments</comments>
		<pubDate>Sat, 23 May 2009 05:09:12 +0000</pubDate>
		<dc:creator>cashplk</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby 习惯]]></category>

		<guid isPermaLink="false">http://cashplk.com/?p=26</guid>
		<description><![CDATA[放狗搜inject的时候找到的。 原帖：http://www.javaeye.com/topic/24642?page=1 Ruby有不少惯用法，这里略作一些介绍，也方便阅读他人代码： 迭代 一般写法: for i in (1..10) puts i end 习惯写法: (1..10).each{&#124;i&#124; puts i} 或 1.upto(10){&#124;i&#124; puts i} &#124;&#124;=赋值 一般写法： number = 1 if number.nil? number = 1 unless number 习惯写法： number &#124;&#124;= 1]]></description>
			<content:encoded><![CDATA[<p>放狗搜inject的时候找到的。<br />
原帖：http://www.javaeye.com/topic/24642?page=1</p>
<p>Ruby有不少惯用法，这里略作一些介绍，也方便阅读他人代码：</p>
<p><strong><span>迭代</span></strong><br />
一般写法:<br />
for i in (1..10) puts i end</p>
<p>习惯写法:</p>
<p>(1..10).each{|i| puts i} 或 1.upto(10){|i| puts i}</p>
<p><strong><span>||=赋值</span></strong><br />
一般写法：<br />
number = 1 if number.nil? number = 1 unless number<br />
习惯写法：</p>
<p>number ||= 1</p>
]]></content:encoded>
			<wfw:commentRss>http://cashplk.com/2009/05/23/ruby%e6%83%af%e7%94%a8%e5%86%99%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->