diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-17 17:29:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-17 17:29:27 +0000 |
commit | d62b90db7327be488007d382f84c469f9fbe4ffe (patch) | |
tree | 153cfe41553b040154ecc89605b797864a76f3c1 /lib/redmine/subclass_factory.rb | |
parent | fcb22595d0e87a2d04fb0210c775efdab6cfffa6 (diff) | |
download | redmine-d62b90db7327be488007d382f84c469f9fbe4ffe.tar.gz redmine-d62b90db7327be488007d382f84c469f9fbe4ffe.zip |
Makes enumerations available through the REST API.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10664 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/subclass_factory.rb')
-rw-r--r-- | lib/redmine/subclass_factory.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/redmine/subclass_factory.rb b/lib/redmine/subclass_factory.rb index a77026993..c494cdf35 100644 --- a/lib/redmine/subclass_factory.rb +++ b/lib/redmine/subclass_factory.rb @@ -22,8 +22,7 @@ module Redmine end module ClassMethods - # Returns an instance of the given subclass name - def new_subclass_instance(class_name, *args) + def get_subclass(class_name) klass = nil begin klass = class_name.to_s.classify.constantize @@ -33,6 +32,12 @@ module Redmine unless subclasses.include? klass klass = nil end + klass + end + + # Returns an instance of the given subclass name + def new_subclass_instance(class_name, *args) + klass = get_subclass(class_name) if klass klass.new(*args) end |