<?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: How to turn a string into CamelCase in Ruby</title>
	<atom:link href="http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/</link>
	<description></description>
	<lastBuildDate>Tue, 12 Jan 2010 15:47:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mister Hectic</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-14318</link>
		<dc:creator>Mister Hectic</dc:creator>
		<pubDate>Fri, 18 Sep 2009 04:59:55 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-14318</guid>
		<description>I always thought camelCase was lowercase for the first-most character. But upon further investigation, I see that is not AlwaysTheCase (LOL @ PascalCase).</description>
		<content:encoded><![CDATA[<p>I always thought camelCase was lowercase for the first-most character. But upon further investigation, I see that is not AlwaysTheCase (LOL @ PascalCase).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-2254</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Wed, 21 May 2008 13:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-2254</guid>
		<description>I&#039;m pretty sure I&#039;ve got this, in case anyone cares:

self.gsub!(/\W+/, &#039; &#039;) # all non-word chars to spaces
self.strip!
self.underscore.split.join(&quot;_&quot;).camelcase(:lower)


assuming that self is a String.  Our implementation mixes this method in to String on application startup.

Hope this helps someone.</description>
		<content:encoded><![CDATA[<p>I&#8217;m pretty sure I&#8217;ve got this, in case anyone cares:</p>
<p>self.gsub!(/\W+/, &#8216; &#8216;) # all non-word chars to spaces<br />
self.strip!<br />
self.underscore.split.join(&#8220;_&#8221;).camelcase(:lower)</p>
<p>assuming that self is a String.  Our implementation mixes this method in to String on application startup.</p>
<p>Hope this helps someone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-2183</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 12 May 2008 13:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-2183</guid>
		<description>This fails if the string is already in camel case.  Also:


phrase.gsub!(/s/, &#039;&#039;)


would return nil if no substitutions were made to phrase.  gsub would return the result of phrase post-gsub even if no changes were made.</description>
		<content:encoded><![CDATA[<p>This fails if the string is already in camel case.  Also:</p>
<p>phrase.gsub!(/s/, &#8221;)</p>
<p>would return nil if no substitutions were made to phrase.  gsub would return the result of phrase post-gsub even if no changes were made.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-726</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Thu, 04 Oct 2007 20:29:53 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-726</guid>
		<description>def wikify(phrase)
  phrase.downcase.gsub(/\b[a-z]/) { &#124;a&#124; a.upcase }.gsub(/\s/, &#039;&#039;)
end</description>
		<content:encoded><![CDATA[<p>def wikify(phrase)<br />
  phrase.downcase.gsub(/\b[a-z]/) { |a| a.upcase }.gsub(/\s/, &#8221;)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-542</link>
		<dc:creator>Jake</dc:creator>
		<pubDate>Thu, 30 Aug 2007 13:59:04 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-542</guid>
		<description>Oh, and I don&#039;t think you even need the return statement. 
I&#039;m pretty sure Ruby methods automagically return the last thing that gets evaluated within.</description>
		<content:encoded><![CDATA[<p>Oh, and I don&#8217;t think you even need the return statement.<br />
I&#8217;m pretty sure Ruby methods automagically return the last thing that gets evaluated within.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake</title>
		<link>http://nealenssle.com/blog/2007/07/21/how-to-turn-a-string-into-a-wikiword-in-ruby/comment-page-1/#comment-541</link>
		<dc:creator>Jake</dc:creator>
		<pubDate>Thu, 30 Aug 2007 13:56:20 +0000</pubDate>
		<guid isPermaLink="false">http://nealenssle.com/blog/2007/07/21/how-to-wikify-a-string-in-ruby/#comment-541</guid>
		<description>If you&#039;re in Rails, you can take advantage of the &lt;a href=&quot;http://api.rubyonrails.com/classes/Inflector.html&quot; rel=&quot;nofollow&quot;&gt;Inflector class&lt;/a&gt; and do something like this:

&gt;&gt; phrase = &#039;my Dog hAs FlEas&#039;
=&gt; &quot;my Dog hAs FlEas&quot;
&gt;&gt; phrase.downcase.gsub(/\s/, &#039;_&#039;).camelize
=&gt; &quot;MyDogHasFleas&quot;

I only know this because the inflector&#039;s &quot;titleize&quot; method is great if you want to &quot;capitalize&quot; multi-word phrases.</description>
		<content:encoded><![CDATA[<p>If you&#8217;re in Rails, you can take advantage of the <a href="http://api.rubyonrails.com/classes/Inflector.html" rel="nofollow">Inflector class</a> and do something like this:</p>
<p>&gt;&gt; phrase = &#8216;my Dog hAs FlEas&#8217;<br />
=&gt; &#8220;my Dog hAs FlEas&#8221;<br />
&gt;&gt; phrase.downcase.gsub(/\s/, &#8216;_&#8217;).camelize<br />
=&gt; &#8220;MyDogHasFleas&#8221;</p>
<p>I only know this because the inflector&#8217;s &#8220;titleize&#8221; method is great if you want to &#8220;capitalize&#8221; multi-word phrases.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
