summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface/action.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/interface/action.rb')
-rw-r--r--lib/puppet/interface/action.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
new file mode 100644
index 000000000..e4c2a4666
--- /dev/null
+++ b/lib/puppet/interface/action.rb
@@ -0,0 +1,16 @@
+require 'puppet/interface'
+
+class Puppet::Interface::Action
+ attr_reader :name
+
+ def initialize(interface, name)
+ name = name.to_s
+ raise "'#{name}' is an invalid action name" unless name =~ /^[a-z]\w*$/
+ @interface = interface
+ @name = name
+ end
+
+ def invoke(*args, &block)
+ @interface.method(name).call(*args,&block)
+ end
+end