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.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index dfd75ef58..d169067ea 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -55,12 +55,12 @@ class Puppet::Interface
remove_const(constantize(name)) rescue nil
end
- def self.unify_name(name)
- name.to_s.downcase.to_sym
- end
-
def self.constantize(name)
- name.to_s.split(/\W|_/).map { |x| x.capitalize }.join
+ unless name.to_s =~ /^[-_a-z]+$/i then
+ raise ArgumentError, "#{name.inspect} (#{name.class}) is not a valid interface name"
+ end
+
+ name.to_s.split(/[-_]/).map { |x| x.capitalize }.join
end
attr_accessor :default_format