From: Paul Brannan Date: 2002-06-13T02:07:12+09:00 Subject: Re: Modules and version determination On Wed, Jun 12, 2002 at 04:45:37AM +0900, Dossy wrote: > I think I brought this up on IRC, suggesting that a published module > should have @@VERSION_MAJOR, @@VERSION_MINOR and @@VERSION_PATCHLEVEL > defined. Ruby uses MAJOR, MINOR, and TEENY. It would be nice to be consistent. > Maybe we just define a ModuleVersion class to make this easier. > Have things like: > > @@version = ModuleVersion.new(3, 1, 4) # Version 3.1.4 > > @@version.to_s # => "3.1.4" > @@version.to_a # => [3, 1, 4] > @@version.major # => 3 > @@version.minor # => 1 > @@version.patchlevel # => 4 I wrote a class called RubyVersion that I use to check to see if I have the right version of Ruby: if RubyVersion.current >= "1.7.1" then # We have the technology else # Must fall back on the old skool way end It can also be used for modules, like you describe: @@version = RubyVersion.new(3, 1, 4) but it's not complete. I definitely like your idea. Paul