Skip to content

Commit

Permalink
Added Module#is_versioned
Browse files Browse the repository at this point in the history
Most libraries are released as modules and would need this.
  • Loading branch information
karouf committed Apr 29, 2011
1 parent a56836c commit 11e5032
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions 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'
Expand Down
11 changes: 11 additions & 0 deletions 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.