<?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:users212</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/212" rel="self"/>
  <title>namxam</title>
  <updated>Sun Mar 02 20:36:29 -0800 2008</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor3619</id>
    <published>2008-03-02T20:36:29-08:00</published>
    <title>[Ruby] On Action Mailer - It has to be easier?</title>
    <content type="html">&lt;p&gt;Haven't had much sleep and therefore my mind might have produced some crappy idea, but maybe might be able to elaborate a little bit more on it. What I would suggest is using the method_missing functionality in order to create the method. This might interfere with the parents implementation for creating the &amp;quot;deliver_&amp;quot; prefixed methods. But I am not that into metaprogramming. Moreover, one might wanna add some check if the rendering of the template works.&lt;/p&gt;

&lt;pre&gt;def method_missing(m, *args)      
  unless m.to_s[0, 8] == 'deliver_'
    from params[:email]
    recipients params[:to]
    subject params[:subject]
    body :params =&amp;gt; params
  end
end&lt;/pre&gt;</content>
    <author>
      <name>namxam</name>
      <email>namxam@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/246-action-mailer-it-has-to-be-easier/refactors/3619" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor459</id>
    <published>2007-10-17T21:02:32-07:00</published>
    <title>[Ruby] On Combining add/remove links</title>
    <content type="html">&lt;p&gt;If you look a little bit closer, you will see, that the first param to Jason's refactored code is the model name, so your call is wrong.&lt;/p&gt;

&lt;pre&gt;&amp;lt;%= add_associated_link 'Email', &amp;quot;Add another&amp;quot; %&amp;gt;&lt;/pre&gt;</content>
    <author>
      <name>namxam</name>
      <email>namxam@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/89-combining-add-remove-links/refactors/459" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor451</id>
    <published>2007-10-17T11:01:50-07:00</published>
    <title>[Ruby] On Rubyize this : 3rd edition</title>
    <content type="html">&lt;p&gt;Based on the nice code from macournoyer, I would suggest a slightly different way of calling the method. Why not to extend the String object and make the function available to all strings. Oh, and added a conveenient way to change the &amp;quot;bad&amp;quot; words.&lt;/p&gt;

&lt;pre&gt;class String
	def to_clean_english(bad_words = %w(stupid moron dumbass retard))
	  bad_words.inject(self) { |clean_sentence, insult| clean_sentence.gsub /#{insult}/i, '*' * insult.size }
	end
end

&amp;quot;you truly are a 'Stupid' moron, stupid sir!&amp;quot;.to_clean_english()&lt;/pre&gt;</content>
    <author>
      <name>namxam</name>
      <email>namxam@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/74-rubyize-this-3rd-edition/refactors/451" rel="alternate"/>
  </entry>
</feed>

