DISQUS

DISQUS Hello! Virtuous Code is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Class.new and .inherited()

Started by avdi · 10 months ago

In Ruby, the typical way to define a class is using the class keyword:


class Foo
# ...
end


The class keyword, however, is effectively just syntax sugar for the Class constructor:


Foo = Class.new
# ...
end


Using Class.new is occasio ... Continue reading »

2 comments

  • Wow, I wrote a long comment... about as long as the original post.
  • Avdi,

    Thanks for sharing. I ran into this todo when refactoring some examples. It seems so odd that the order in which .inherited is called changes depending on how you construct the class.

Add New Comment

Returning? Login