<?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>State Of Flux &#187; inheritance</title>
	<atom:link href="http://stateofflux.com/tag/inheritance/feed/" rel="self" type="application/rss+xml" />
	<link>http://stateofflux.com</link>
	<description>always changing</description>
	<lastBuildDate>Fri, 29 Jan 2010 03:29:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Class inherits from</title>
		<link>http://stateofflux.com/2008/08/03/class-inherits-from/</link>
		<comments>http://stateofflux.com/2008/08/03/class-inherits-from/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 06:41:00 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://markmansour.wordpress.com//2008/08/03/class-inherits-from</guid>
		<description><![CDATA[I wanted to know if a class was an Active Record class. I couldn&#8217;t find an easy way to do it in Ruby so I monkey patches the Class object like so (assuming Person is an active record model object). class Class def inherits_from?(klass, me=self) return false if me.nil? return true if me == klass [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to know if a class was an Active Record class.  I couldn&#8217;t find an easy way to do it in Ruby so I monkey patches the Class object like so (assuming Person is an active record model object).</p>
<pre lang="ruby">
class Class
  def inherits_from?(klass, me=self)
    return false if me.nil?
    return true if me == klass
    inherits_from? klass, me.superclass
  end
end

>> Person.inherits_from? ActiveRecord::Base
=> true
</pre>
]]></content:encoded>
			<wfw:commentRss>http://stateofflux.com/2008/08/03/class-inherits-from/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

