<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: indirect code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 21:26:44 GMT</pubDate>
    <description>DZone Snippets: indirect code</description>
    <item>
      <title>Ruby - "meta method" execute</title>
      <link>http://snippets.dzone.com/posts/show/4452</link>
      <description>//&lt;br /&gt;//&lt;br /&gt;// attempt to execute a method indirectly, I don't know if&lt;br /&gt;// it's possible, but I suspect it is, and probably just&lt;br /&gt;// have the syntax wrong&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ar = %w(apples bananas oranges)&lt;br /&gt;&lt;br /&gt;print "\n ar.class = #{ar.class}"&lt;br /&gt;&lt;br /&gt;print "\n ar.methods = #{ar.methods.sort}"&lt;br /&gt;puts "======================================================="&lt;br /&gt;&lt;br /&gt;mets = ar.methods.sort&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# this doesn't work ... is there a syntax for doing this?&lt;br /&gt;#                       i.e. calling a 'meta' method ?&lt;br /&gt;#&lt;br /&gt;# call each method of 'ar' (an array)&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;mets.each {|method| ar.method} &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 23 Aug 2007 19:19:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4452</guid>
      <author>mstram (Mike Stramba)</author>
    </item>
  </channel>
</rss>
