This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Module no-no's
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Why? Because if someone mixes your module into their class, and they don't have a VERSION defined for that class, they're going to end up with your version number for the class. This is probably not what anyone wants.
If you want to assign a version to your module, but don't want to step on anyone's toes, use the module name as part of the version so that folks can distinguish between a class VERSION and a module VERSION if they want to, e.g.
module Foo
FOO_VERSION = "1.0.0"
end
class Bar
include Foo
VERSION = "1.3.2"
end
p Bar::VERSION # "1.3.2"
p Bar::FOO_VERSION # "1.0.0"