<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Disqus - Latest Comments for Farrel Lifson</title><link>http://disqus.com/people/05be5d6610e2c3f1780aa0e39e902e93/</link><description></description><language>en</language><lastBuildDate>Sun, 04 Jun 2006 09:25:15 -0000</lastBuildDate><item><title>Re: Commenting in Ruby</title><link>http://lifeisgrand.disqus.com/commenting_in_ruby/#comment-1280358</link><description>Pretty much most people don't even use the =begin/=end blocks any more. I just write stuff like&lt;br&gt;&lt;br&gt;# This function adds two numbers together.&lt;br&gt;# No overflow checking is provided.&lt;br&gt;def sum(a,b)&lt;br&gt;  a + b&lt;br&gt;end&lt;br&gt;&lt;br&gt;It's easier to read and makes the comments more discernible.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Farrel Lifson</dc:creator><pubDate>Tue, 09 May 2006 15:30:27 -0000</pubDate></item><item><title>Re: A dirty Ruby</title><link>http://lifeisgrand.disqus.com/a_dirty_ruby/#comment-1280375</link><description>I haven't used WSDLDriver but doe the tag object respond to to_a? If so you can do the following:&lt;br&gt;&lt;br&gt;if soapResponse.getNewTagsSinceResult.respond_to? "tag"&lt;br&gt;  for tag in soapResponse.getNewTagsSinceResult.tag.to_a&lt;br&gt;   @tag = Tag.find_by_sync_id(tag.id)&lt;br&gt;   if (@tag)&lt;br&gt;    @tag.name = tag.name&lt;br&gt;    @tag.save&lt;br&gt;   else&lt;br&gt;    @tag = Tag.new&lt;br&gt;    @tag.name = tag.name&lt;br&gt;    @tag.sync_id = tag.id&lt;br&gt;    @tag.save&lt;br&gt;   end&lt;br&gt;  end&lt;br&gt;end&lt;br&gt;&lt;br&gt;Just a quick warning that currently all objects respond to to_a but this will soon be deprecated so for future versions it's better to check that the tag object class explicity implements to_a.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Farrel Lifson</dc:creator><pubDate>Wed, 10 May 2006 15:18:22 -0000</pubDate></item><item><title>Re: A dirty Ruby</title><link>http://lifeisgrand.disqus.com/a_dirty_ruby/#comment-1280376</link><description>Also if you really want to squeeze things down you can do this:&lt;br&gt;&lt;br&gt;@tag = Tag.find_by_syn_id(tag.id) || Tag.new&lt;br&gt;@tag.name = tag.name&lt;br&gt;@tag.sync_id ||= tag.id&lt;br&gt;@tag.save</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Farrel Lifson</dc:creator><pubDate>Wed, 10 May 2006 16:07:49 -0000</pubDate></item><item><title>Re: A dirty Ruby</title><link>http://lifeisgrand.disqus.com/a_dirty_ruby/#comment-1280378</link><description>I did some further experimenting and it seems it's recommended to use Array(object) instead of object.to_a.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Farrel Lifson</dc:creator><pubDate>Thu, 11 May 2006 03:41:51 -0000</pubDate></item><item><title>Re: Random Ruby Password Magic</title><link>http://lifeisgrand.disqus.com/random_ruby_password_magic/#comment-1280467</link><description>IMO I prefer 8.times over 1.upto(8).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Farrel Lifson</dc:creator><pubDate>Sun, 04 Jun 2006 09:25:15 -0000</pubDate></item></channel></rss>