eigenclass

Why isn't the eigenclass equivalent to self.class, when it looks so similar?

I've missed the memo somewhere, and I hope you'll explain this to me. Why is the eigenclass of an object different from self.class? class Foo def initialize(symbol) eigenclass = class << self self end eigenclass.class_eval do attr_accessor symbol end end end My train of logic that equates the eigenclas...

Difference between 'self.method_name' and 'class << self' in Ruby

I was trying to limit the instantiation of a class to just a single one(without using singleton) but i couldn't. I tried with class variables (@@) but without luck. I googled it and came across this: class A @count = 0 class << self attr_accessor :count end def initialize val @a = val self.class.count += 1 ...

class << self idiom in Ruby

I suppose my question is exactly what the subject depicts, what does: class << self do in Ruby? ...

Ruby class question

Possible Duplicate: class << self idiom in Ruby I have a quick Ruby question. I come from a Java/c background, so I understand in Ruby "self" when referenced inside a instance method acts like "this". And "self." prefix for method defines it as a class method. But what does this mean here?? class << self def some_method ...