diff options
| author | Luke Kanies <luke@madstop.com> | 2007-09-24 15:58:44 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-09-24 15:58:44 -0500 |
| commit | 2e3306143b1f58765f48911ba433a119de323b84 (patch) | |
| tree | 40e50f0165553260bd37c90356659179027d0029 /lib | |
| parent | d6fd60cca15641fc1341cce52faf0506d7665044 (diff) | |
| download | puppet-2e3306143b1f58765f48911ba433a119de323b84.tar.gz puppet-2e3306143b1f58765f48911ba433a119de323b84.tar.xz puppet-2e3306143b1f58765f48911ba433a119de323b84.zip | |
I changed the Terminus class to switch camelcase
to underscore-separated words, e.g., FactStore becomes
fact_store.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/indirector/terminus.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/puppet/indirector/terminus.rb b/lib/puppet/indirector/terminus.rb index bcff08d79..3e0ea447c 100644 --- a/lib/puppet/indirector/terminus.rb +++ b/lib/puppet/indirector/terminus.rb @@ -26,7 +26,7 @@ class Puppet::Indirector::Terminus elsif ind = Puppet::Indirector::Indirection.instance(name) @indirection = ind else - raise ArgumentError, "Could not find indirection instance %s" % name + raise ArgumentError, "Could not find indirection instance %s for %s" % [name, self.name] end end @@ -39,7 +39,9 @@ class Puppet::Indirector::Terminus raise ArgumentError, "Terminus subclasses must have associated constants" end names = longname.split("::") - name = names.pop.downcase.intern + + # Convert everything to a lower-case symbol, converting camelcase to underscore word separation. + name = names.pop.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_" + i.downcase }.intern subclass.name = name |
