<?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:users1379</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/1379" rel="self"/>
  <title>teamco-anthill.blogspot.com</title>
  <updated>Wed Mar 17 13:33:54 -0700 2010</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor483729</id>
    <published>2010-03-17T13:33:54-07:00</published>
    <title>[Ruby] On Simple if staments</title>
    <content type="html">

&lt;pre&gt;def validate_permalink(attr_name)
    sanitize_permalink(permalink? ? attr_name : permalink)
end

&lt;/pre&gt;</content>
    <author>
      <name>teamco-anthill.blogspot.com</name>
      <email>teamco@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/1227-simple-if-staments/refactors/483729" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor290305</id>
    <published>2009-09-03T13:51:41-07:00</published>
    <title>[Ruby] On Remove element from array</title>
    <content type="html">&lt;p&gt;Smaller version
&lt;/p&gt;

&lt;pre&gt;@recipients = reply.case.users.map(&amp;amp;:email).delete(reply.created_by.email)*&amp;quot;,&amp;quot;&lt;/pre&gt;</content>
    <author>
      <name>teamco-anthill.blogspot.com</name>
      <email>teamco@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/1023-remove-element-from-array/refactors/290305" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code786</id>
    <published>2009-03-15T12:50:39-07:00</published>
    <updated>2009-03-15T12:52:47-07:00</updated>
    <title>[Ruby] Download file</title>
    <content type="html">&lt;p&gt;Try to refactor send file code&lt;/p&gt;

&lt;pre&gt;  def download
    dl_opts = params[:dl].nil? ?   'attachment' : 'inline'
    dl_img  = params[:type].nil? ? &amp;quot;&amp;quot; : &amp;quot;_#{params[:type]}&amp;quot;
    dl_file = FileUpload.find_by_item_id(params[:id])
    unless dl_file.nil?
      dl_file_type   = dl_file.mime_type
      dl_file_ext    = dl_file_type.item.self_title
      dl_file_name   = &amp;quot;#{dl_file.original_name}#{dl_img}.#{dl_file_ext}&amp;quot;
      dl_file_path   = &amp;quot;#{RAILS_ROOT}/public/upload/#{dl_file.id}/&amp;quot;
      dl_file_title  = dl_file.item.self_title
      dl_public_name = dl_file_title == dl_file_name ? dl_file_name :
                                                       &amp;quot;#{dl_file_title}#{dl_img}.#{dl_file_ext}&amp;quot;
      send_file(&amp;quot;#{dl_file_path}#{dl_file_name}&amp;quot;,
                :disposition =&amp;gt; dl_opts,
                :encoding    =&amp;gt; 'utf8',
                :type        =&amp;gt; dl_file_type.content_type,
                :filename    =&amp;gt; URI.encode(dl_public_name))
    end
  end
&lt;/pre&gt;</content>
    <author>
      <name>teamco-anthill.blogspot.com</name>
      <email>teamco@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/786-download-file" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor150897</id>
    <published>2009-03-15T12:31:17-07:00</published>
    <title>[Ruby] On Ruby Idioms</title>
    <content type="html">&lt;p&gt;Refactored by Netbeans hints&lt;/p&gt;

&lt;pre&gt;def archive_files(source, glob_mask, destination)
  Dir.glob(File.join(source, glob_mask)) do |file| 
    should_copy_file = true
    should_copy_file = yield(file) if (block_given?)
    FileUtils.cp_r(file, destination) if File.file?(file) if (should_copy_file)
  end
end&lt;/pre&gt;</content>
    <author>
      <name>teamco-anthill.blogspot.com</name>
      <email>teamco@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/782-ruby-idioms/refactors/150897" rel="alternate"/>
  </entry>
</feed>

