From: Ryan Davis Date: 2011-11-12T05:58:02+09:00 Subject: Re: referring to version numbers in a gem On Nov 11, 2011, at 12:28 , Chad Perrin wrote: > How do I specify and access a gem's version number within the code of the > gem itself? For example: > > 1. I write a library. > 2. I write a command line utility that uses that library. > 3. The utility uses OptionParser, with a --version option. > 4. I package the things up inside a gem. > > What's the best way to specify the version number and give the code > executed when the --version argument is supplied the ability to access > that version number? ?? I usually just use a constant (eg, Hoe::VERSION)... but I don't think that's what you're asking because that's too obvious. Do you really need to get "the gem's version number"? If you're looking to be able to choose what version of the dependent library you want to load, look at any and every gem wrapper (eg rake, sow, flog, etc). They all have that built-in.