summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface.rb
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-03-23 16:28:28 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-03-23 16:28:28 -0700
commitc25fb94725c9abfb36e67938356f97823f8b605e (patch)
tree7ce11df541c57fb660cefef71eee6f0eba429df2 /lib/puppet/interface.rb
parent7aa8f2252c7b0512c929fb87a6c3a09a952a142a (diff)
downloadpuppet-c25fb94725c9abfb36e67938356f97823f8b605e.tar.gz
puppet-c25fb94725c9abfb36e67938356f97823f8b605e.tar.xz
puppet-c25fb94725c9abfb36e67938356f97823f8b605e.zip
(#6770) Rename Puppet::Interface::interface method.
Puppet::Interface::interface is now Puppet::Interface::define, also aliased to Puppet::Interface::[] for convenience. Paired-With: Nick Lewis
Diffstat (limited to 'lib/puppet/interface.rb')
-rw-r--r--lib/puppet/interface.rb52
1 files changed, 28 insertions, 24 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 7f208f56c..64f1bfe49 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -10,35 +10,39 @@ class Puppet::Interface
include Puppet::Util
- # This is just so we can search for actions. We only use its
- # list of directories to search.
- # Can't we utilize an external autoloader, or simply use the $LOAD_PATH? -pvb
- def self.autoloader
- @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/interface")
- end
+ class << self
+ # This is just so we can search for actions. We only use its
+ # list of directories to search.
+ # Can't we utilize an external autoloader, or simply use the $LOAD_PATH? -pvb
+ def autoloader
+ @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/interface")
+ end
- def self.interfaces
- Puppet::Interface::InterfaceCollection.interfaces
- end
+ def interfaces
+ Puppet::Interface::InterfaceCollection.interfaces
+ end
- def self.interface?(name, version)
- Puppet::Interface::InterfaceCollection.interface?(name, version)
- end
+ def interface?(name, version)
+ Puppet::Interface::InterfaceCollection.interface?(name, version)
+ end
- def self.register(instance)
- Puppet::Interface::InterfaceCollection.register(instance)
- end
+ def register(instance)
+ Puppet::Interface::InterfaceCollection.register(instance)
+ end
- def self.interface(name, version, &blk)
- if interface?(name, version)
- interface = Puppet::Interface::InterfaceCollection[name, version]
- interface.instance_eval(&blk) if blk
- else
- interface = self.new(name, :version => version, &blk)
- Puppet::Interface::InterfaceCollection.register(interface)
- interface.load_actions
+ def define(name, version, &blk)
+ if interface?(name, version)
+ interface = Puppet::Interface::InterfaceCollection[name, version]
+ interface.instance_eval(&blk) if blk
+ else
+ interface = self.new(name, :version => version, &blk)
+ Puppet::Interface::InterfaceCollection.register(interface)
+ interface.load_actions
+ end
+ return interface
end
- return interface
+
+ alias :[] :define
end
attr_accessor :default_format