From: Greg McIntyre Date: 2003-11-30T12:07:08+09:00 Subject: class << x [ruby-talk:86745] reminded me of something I was going to ask. I know "class << x" does, but can somebody explain to me the rationale behind the syntax? How should I "read" it? I currently read it as "open x's class for modification". Is that right? I was quite confused about it when I first learned Ruby. class A class << self # what does this mean? (says newbie Greg) # ... end end Even the more "direct" usage is confusing, IMHO: class B # ... end b = B.new class << b # what does this mean? (says newbie Greg) def f # ... end end What about this, as an alternative (for Ruby 2?): class A class A # or "class self" # ... end end class b.class def f # ... end end -- Greg McIntyre ======[ greg@puyo.cjb.net ]===[ http://puyo.cjb.net ]===