Permalink
Browse files

Added Module#is_versioned

Most libraries are released as modules and would need this.
  • Loading branch information...
1 parent a56836c commit 11e5032bed024189b81b4a9f0f9d7b76e8a0809c @karouf karouf committed Apr 29, 2011
Showing with 12 additions and 0 deletions.
  1. +1 −0 lib/version.rb
  2. +11 −0 lib/version/ext/module.rb
View
1 lib/version.rb
@@ -1,4 +1,5 @@
require 'version/ext/array'
+require 'version/ext/module'
require 'version/ext/class'
require 'version/ext/hash'
require 'version/ext/string'
View
11 lib/version/ext/module.rb
@@ -0,0 +1,11 @@
+require 'version'
+
+class Module
+ #
+ # Automagically sets a VERSION constant in the current module according to
+ # the results of Version.current.
+ #
+ def is_versioned
+ const_set :VERSION, Version.current(File.dirname(caller.first))
+ end
+end

0 comments on commit 11e5032

Please sign in to comment.