<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Adventures in Ruby: When Constants Aren&#8217;t</title>
	<atom:link href="http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/</link>
	<description>Enrico on programming, living, and everything in between</description>
	<lastBuildDate>Tue, 22 Jun 2010 16:13:06 -0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Dan Kubb</title>
		<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/comment-page-1/#comment-1358</link>
		<dc:creator>Dan Kubb</dc:creator>
		<pubDate>Tue, 17 Nov 2009 04:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.liveandcode.com/?p=249#comment-1358</guid>
		<description>One thing I&#039;d recommend is using freeze on the constant when you define it, eg:

  SERVICE_URL = &#039;http://accountingservice.com/&#039;.freeze

That way at least you won&#039;t append to it accidentally.  You&#039;ll be forced to clone it, or come up with other ways of using it that don&#039;t involve modifying it.</description>
		<content:encoded><![CDATA[<p>One thing I&#8217;d recommend is using freeze on the constant when you define it, eg:</p>
<p>  SERVICE_URL = &#8216;http://accountingservice.com/&#8217;.freeze</p>
<p>That way at least you won&#8217;t append to it accidentally.  You&#8217;ll be forced to clone it, or come up with other ways of using it that don&#8217;t involve modifying it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Hoffman</title>
		<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/comment-page-1/#comment-1348</link>
		<dc:creator>Nick Hoffman</dc:creator>
		<pubDate>Mon, 16 Nov 2009 20:27:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.liveandcode.com/?p=249#comment-1348</guid>
		<description>Ah true, you did say that the posted code was a simplified example  =P</description>
		<content:encoded><![CDATA[<p>Ah true, you did say that the posted code was a simplified example  =P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enrico</title>
		<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/comment-page-1/#comment-1346</link>
		<dc:creator>Enrico</dc:creator>
		<pubDate>Mon, 16 Nov 2009 18:29:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.liveandcode.com/?p=249#comment-1346</guid>
		<description>I have a lot more parameters than that to append; there are up to six in my code right now. That&#039;d make for a considerably long line. I might be able to clean it up by using string interpolation, however:

def transaction_url
  &quot;#{SERVICE_URL}VAL1=#{value1}&amp;VAL2=#{value2}...&quot;
end

EDIT: ...or, you know, I could just break it into multiple lines.  =P</description>
		<content:encoded><![CDATA[<p>I have a lot more parameters than that to append; there are up to six in my code right now. That&#8217;d make for a considerably long line. I might be able to clean it up by using string interpolation, however:</p>
<p>def transaction_url<br />
  &#8220;#{SERVICE_URL}VAL1=#{value1}&#038;VAL2=#{value2}&#8230;&#8221;<br />
end</p>
<p>EDIT: &#8230;or, you know, I could just break it into multiple lines.  =P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Hoffman</title>
		<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/comment-page-1/#comment-1345</link>
		<dc:creator>Nick Hoffman</dc:creator>
		<pubDate>Mon, 16 Nov 2009 18:26:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.liveandcode.com/?p=249#comment-1345</guid>
		<description>I was bitten by this bug a few months ago, actually. It was annoying, but it definitely taught me (and you, obviously) about some of the innards of Ruby constants.

Rather than cloning SERVICE_URL, why not just do this?:

def transaction_url
  SERVICE_URL + &#039;VAL1=foo&#039; + &#039;&amp;VAL2=bar&#039;
end</description>
		<content:encoded><![CDATA[<p>I was bitten by this bug a few months ago, actually. It was annoying, but it definitely taught me (and you, obviously) about some of the innards of Ruby constants.</p>
<p>Rather than cloning SERVICE_URL, why not just do this?:</p>
<p>def transaction_url<br />
  SERVICE_URL + &#8216;VAL1=foo&#8217; + &#8216;&amp;VAL2=bar&#8217;<br />
end</p>
]]></content:encoded>
	</item>
</channel>
</rss>
