<?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:users1901</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/1901" rel="self"/>
  <title>mrgrande.livejournal.com</title>
  <updated>Fri Jan 22 20:59:35 -0800 2010</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor424386</id>
    <published>2010-01-22T20:59:35-08:00</published>
    <title>[Ruby] On Making email addresses out of common names</title>
    <content type="html">&lt;p&gt;Not much to add, but you could shoten your one if quite nicely, since pop returns the element it's popping.&lt;/p&gt;

&lt;pre&gt;if name.length &amp;gt; 2
  name[1] = name[1] + name.pop
end

# or even:
name[1] = name[1] + name.pop if name.length &amp;gt; 2&lt;/pre&gt;</content>
    <author>
      <name>mrgrande.livejournal.com</name>
      <email></email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/1146-making-email-addresses-out-of-common-names/refactors/424386" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code1154</id>
    <published>2010-01-22T20:24:06-08:00</published>
    <updated>2010-01-25T04:11:22-08:00</updated>
    <title>[C#] Two methods, two enums.</title>
    <content type="html">&lt;p&gt;I have these two very similar methods.  Both do the same thing, but one is based off the enum FIRSTSTATUS and the other is based off SECONDSTATUS.  I'd like to cut this down to one method, but I'm not sure the best way.&lt;/p&gt;

&lt;pre&gt;private static bool SetFolderBasedOnFirstStatus(PurchaseOrder po)
{
    bool documentFinished = false;

    if (po.FirstStatus == FIRSTSTATUS.Complete)
    {
        po.Folder = DOCUMENTFOLDER.History;
        documentFinished = true;
    }
    else if (po.FirstStatus == FIRSTSTATUS.Partial)
        po.Folder = DOCUMENTFOLDER.InProgress;
    else
    {
        po.Folder = DOCUMENTFOLDER.Inbox;    
    }
    return documentFinished;
}

private static bool SetFolderBasedOnSecondStatus(PurchaseOrder po)
{
    bool documentFinished = false;

    if (po.SecondStatus == SECONDSTATUS.Complete)
    {
        po.Folder = DOCUMENTFOLDER.History;
        documentFinished = true;
    }
    else if (po.SecondStatus == SECONDSTATUS.Partial)
    {
        po.Folder = DOCUMENTFOLDER.InProgress;
    }

    return documentFinished;
}&lt;/pre&gt;</content>
    <author>
      <name>mrgrande.livejournal.com</name>
      <email>no-email@refactormycode.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/1154-two-methods-two-enums" rel="alternate"/>
  </entry>
</feed>

