<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CookedApple &#187; 1.9</title>
	<atom:link href="http://cookedapple.net/tag/19/feed/" rel="self" type="application/rss+xml" />
	<link>http://cookedapple.net</link>
	<description>All our thoughts. Broadcasted.</description>
	<lastBuildDate>Tue, 24 Aug 2010 10:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ruby: Getting current method name</title>
		<link>http://cookedapple.net/2008/10/22/ruby-getting-current-method-name/</link>
		<comments>http://cookedapple.net/2008/10/22/ruby-getting-current-method-name/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 12:25:22 +0000</pubDate>
		<dc:creator>Piero Bozzolo</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[1.8]]></category>
		<category><![CDATA[1.9]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://cookedapple.net/?p=235</guid>
		<description><![CDATA[In ruby 1.9 è possibile utilizzare la variabile __method__ per ottenere il nome del metodo attualmente chiamato. In ruby 1.8 non esiste un modo diretto per accedere al nome del metodo ma è possibile accedere alla variabile caller che, tra le altre informazioni, contiene il nome del metodo chiamante (tips trovato su internet). Ecco come [...]]]></description>
			<content:encoded><![CDATA[<p>In ruby 1.9 è possibile utilizzare la variabile __method__ per ottenere il nome del metodo attualmente chiamato. In ruby 1.8 non esiste un modo diretto per accedere al nome del metodo ma è possibile accedere alla variabile caller che, tra le altre informazioni, contiene il nome del metodo chiamante (tips trovato su internet). Ecco come creare un metodo funzionante su entrambe le versioni:</p>
<blockquote><p>def method_name<br />
if RUBY_VERSION.to_f &lt; 1.9<br />
caller[0]=~/`(.*?)&#8217;/<br />
$1<br />
else<br />
__method__<br />
end<br />
end</p></blockquote>
<p>Se chiamerò da un metodo <em>foo()</em> <strong>method_name</strong> otterò sempre &#8216;foo&#8217;</p>
]]></content:encoded>
			<wfw:commentRss>http://cookedapple.net/2008/10/22/ruby-getting-current-method-name/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
