<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users156</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/156" rel="self"/>
  <title>Carl Porth</title>
  <updated>Wed Sep 10 16:59:18 -0700 2008</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor16944</id>
    <published>2008-09-10T16:59:18-07:00</published>
    <title>[Ruby] On x.kind_of? MyClass or x.class ==MyClass</title>
    <content type="html">&lt;p&gt;I tend to see the use of ===&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre&gt;module M; end

class A; end

class B &amp;lt; A
  include M
end

b = B.new

A === b # =&amp;gt; true
B === b # =&amp;gt; true
M === b # =&amp;gt; true
&lt;/pre&gt;</content>
    <author>
      <name>Carl Porth</name>
      <email>badcarl@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/487-x-kind_of-myclass-or-x-class-myclass/refactors/16944" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor14678</id>
    <published>2008-08-09T06:49:18-07:00</published>
    <title>[Ruby] On Caesar Cipher</title>
    <content type="html">&lt;p&gt;I've always seen shifts done with the unix tr command.   You can do the same in ruby.  Additionally this method handles the rotation of chars like &lt;/p&gt;

&lt;p&gt;caesar(&amp;quot;ABCDEF&amp;quot;,22) #=&amp;gt; &amp;quot;WXYZAB&amp;quot;&lt;/p&gt;

&lt;pre&gt;def caesar(text,n)
  alpha = ('A'..'Z').to_a
  n.times { alpha.push(alpha.shift) }
  text.tr('A-Z', alpha.join)
end&lt;/pre&gt;</content>
    <author>
      <name>Carl Porth</name>
      <email>badcarl@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/427-caesar-cipher/refactors/14678" rel="alternate"/>
  </entry>
</feed>

