<?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>NinjaCipher &#187; rails</title>
	<atom:link href="http://www.ninjacipher.com/category/development/ruby/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ninjacipher.com</link>
	<description>kungpow programming</description>
	<lastBuildDate>Thu, 25 Mar 2010 14:39:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='www.ninjacipher.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>ruby tip</title>
		<link>http://www.ninjacipher.com/2007/03/15/ruby-tip/</link>
		<comments>http://www.ninjacipher.com/2007/03/15/ruby-tip/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 22:50:10 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=23</guid>
		<description><![CDATA[Here is a quick ruby function that takes a array of objects
(could be the resultset from a find call) and a member name
and creates a multimap collection (basically a hash of arrays)
that can then be easily displayed in a threaded manor. 

def segment_by_field(objs,member='unthreaded')
  retVals = Hash.new
  prev_val = nil
  for obj in [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick ruby function that takes a array of objects<br />
(could be the resultset from a find call) and a member name<br />
and creates a multimap collection (basically a hash of arrays)<br />
that can then be easily displayed in a threaded manor. </p>
<pre>
def segment_by_field(objs,member='unthreaded')
  retVals = Hash.new
  prev_val = nil
  for obj in objs
    if member != 'unthreaded'
      current_val = obj.send(member)
      if prev_val.nil? or !retVals.has_key?(current_val)
        retVals[current_val] = Array.new
      end
      prev_val = current_val
      retVals[prev_val] << obj
    else
      retVals[member] = Array.new unless retVals.has_key?(member)
      retVals[member] << obj
    end
  end
  return retVals
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2007/03/15/ruby-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
