summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-16 15:22:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-16 15:22:48 +0000
commit97252c26eefe3dfa5e0c3cb059fe66cb21b2e34d (patch)
treee41bfd5350ac7a44aa89849834f8d432b9014960 /lib
parent94b5bbcb5d225ec1bfe29e6aa4e8b8eb7d137abf (diff)
downloadredmine-97252c26eefe3dfa5e0c3cb059fe66cb21b2e34d.tar.gz
redmine-97252c26eefe3dfa5e0c3cb059fe66cb21b2e34d.zip
Adds plugin id attribute.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2038 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/plugin.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index 87a6ce4d3..17953ef8c 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -56,12 +56,21 @@ module Redmine #:nodoc:
end
end
def_field :name, :description, :author, :version, :settings
-
+ attr_reader :id
+
# Plugin constructor
- def self.register(name, &block)
- p = new
+ def self.register(id, &block)
+ p = new(id)
p.instance_eval(&block)
- Plugin.registered_plugins[name] = p
+ Plugin.registered_plugins[id] = p
+ end
+
+ def initialize(id)
+ @id = id.to_sym
+ end
+
+ def <=>(plugin)
+ self.id.to_s <=> plugin.id.to_s
end
# Adds an item to the given +menu+.