Quantcast
Channel: Pragmatic Forums | Posts by Bharat Ruparel
Viewing all articles
Browse latest Browse all 25

Not sure how to interpret this? posted by Bharat Ruparel @ Tue, 22 Jul 2008 01:35:40 +0000

$
0
0

David,
I am maintaining a Rails App that is using backgroundDrb. It creates a helper file called dbrb_test_helper.rb in the test directory. Amongst other things, it has the following piece of code that I cannot understand:

class Object
 def self.metaclass
  class << self
   self
  end
 end
...
end

So we are adding a “class” method to the Object (class? instance?) named ‘metaclass’. So if I understand your teaching thus far: There is a ghost class created for the object ‘Object’ that has a method metaclass defined in it. So far so good, but what in the world are the following lines of code are for?

class << self
   self
end

I don’t get it. Kindly explain. This is one too many selfs for me.

Bharat


Viewing all articles
Browse latest Browse all 25

Trending Articles