summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/interface.rb')
-rw-r--r--lib/puppet/interface.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index f9b26950a..dfd75ef58 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -42,20 +42,25 @@ class Puppet::Interface
nil
end
+ def self.const_get(name)
+ name = constantize(name)
+ super(name)
+ end
+
def self.register_interface(name, instance)
- const_set(name2const(name), instance)
+ const_set(constantize(name), instance)
end
def self.unload_interface(name)
- remove_const(name2const(name)) rescue nil
+ remove_const(constantize(name)) rescue nil
end
def self.unify_name(name)
name.to_s.downcase.to_sym
end
- def self.name2const(name)
- name.to_s.capitalize
+ def self.constantize(name)
+ name.to_s.split(/\W|_/).map { |x| x.capitalize }.join
end
attr_accessor :default_format