class << self

No Comments

While working on NORM, I found a nice trick where you can enclose your class variables and methods inside a class << self … end block. I was aware of the ability to create class methods by using the def ClassName.method_name definition, but where I’m creating a series of class methods in NORM, I found this notation to be more useful.

I’m sure there will be more ruby stuff yet to be learned.

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

No Comments »

No comments yet.

Leave a comment