<?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:users368</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/368" rel="self"/>
  <title>mvanholstyn</title>
  <updated>Fri Aug 01 04:17:50 -0700 2008</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor14274</id>
    <published>2008-08-01T04:17:50-07:00</published>
    <title>[Ruby] On Easy - descending range</title>
    <content type="html">

&lt;pre&gt;rows_in_order = side == :white ? (0..7) : (0..7).to_a.reverse&lt;/pre&gt;</content>
    <author>
      <name>mvanholstyn</name>
      <email>mvanholstyn@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/414-easy-descending-range/refactors/14274" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor12577</id>
    <published>2008-07-05T15:57:56-07:00</published>
    <title>[Ruby] On Human Date Method</title>
    <content type="html">

&lt;pre&gt;def date(date, time = false)
    date = Date.parse(date) if date.class.is_a? String
    format = time ? &amp;quot;%B #{date.day}, %Y at #{date.strftime('%I').to_i}:%M %p&amp;quot; : &amp;quot;%B #{date.day}, %Y&amp;quot;
    date.strftime(format)
end&lt;/pre&gt;</content>
    <author>
      <name>mvanholstyn</name>
      <email>mvanholstyn@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/351-human-date-method/refactors/12577" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor1341</id>
    <published>2008-01-03T14:33:15-08:00</published>
    <title>[Ruby] On Rubyize this : 5th edition</title>
    <content type="html">

&lt;pre&gt;def highlight_text(input, words_to_highlight = [], wrapper = '*\1*')
  input.gsub(/\b(#{words_to_highlight.join(&amp;quot;|&amp;quot;)})\b/, wrapper)
end&lt;/pre&gt;</content>
    <author>
      <name>mvanholstyn</name>
      <email>mvanholstyn@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/203-rubyize-this-5th-edition/refactors/1341" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor864</id>
    <published>2007-11-16T04:30:15-08:00</published>
    <title>[Ruby] On Simple Text Replacement</title>
    <content type="html">&lt;p&gt;bilson -- that code is running for me -- you sure the replacements are not taking place?&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;</content>
    <author>
      <name>mvanholstyn</name>
      <email>mvanholstyn@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/155-simple-text-replacement/refactors/864" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor861</id>
    <published>2007-11-16T02:50:10-08:00</published>
    <title>[Ruby] On Simple Text Replacement</title>
    <content type="html">

&lt;pre&gt;def replace_keywords(keyword_hash, text_to_parse)
  text_to_parse.gsub(/\{(.*?)\}/) do |match|
    keyword_hash[$1] || match
  end
end

my_hash = { 'city' =&amp;gt; 'Chicago', 'state' =&amp;gt; 'Illinois' }
my_text = &amp;quot;Welcome to {city}, {state}&amp;quot;

puts replace_keywords( my_hash, my_text ) # =&amp;gt;'Welcome to Chicago, Illinois'&lt;/pre&gt;</content>
    <author>
      <name>mvanholstyn</name>
      <email>mvanholstyn@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/155-simple-text-replacement/refactors/861" rel="alternate"/>
  </entry>
</feed>

