diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:33:03 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:33:03 -0700 |
commit | 9ce031d300738c778254358792ee295c08252cff (patch) | |
tree | c0489dfd1b5d0a2cdf516d51f34a87e18c150e94 /lib/puppet/string/action_builder.rb | |
parent | 505a48c0d316aad7ff26ae2c0ade294707ca081e (diff) | |
parent | 0c74495529bd697cdc42986882fc3efb4cdc9903 (diff) | |
download | puppet-9ce031d300738c778254358792ee295c08252cff.tar.gz puppet-9ce031d300738c778254358792ee295c08252cff.tar.xz puppet-9ce031d300738c778254358792ee295c08252cff.zip |
Merge branch 'feature/master/6749-actions-need-to-support-options'
Diffstat (limited to 'lib/puppet/string/action_builder.rb')
-rw-r--r-- | lib/puppet/string/action_builder.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/puppet/string/action_builder.rb b/lib/puppet/string/action_builder.rb index b3db51104..e76044470 100644 --- a/lib/puppet/string/action_builder.rb +++ b/lib/puppet/string/action_builder.rb @@ -5,10 +5,8 @@ class Puppet::String::ActionBuilder attr_reader :action def self.build(string, name, &block) - name = name.to_s - raise "Action '#{name}' must specify a block" unless block - builder = new(string, name, &block) - builder.action + raise "Action #{name.inspect} must specify a block" unless block + new(string, name, &block).action end def initialize(string, name, &block) @@ -24,4 +22,9 @@ class Puppet::String::ActionBuilder raise "Invoke called on an ActionBuilder with no corresponding Action" unless @action @action.invoke = block end + + def option(*declaration, &block) + option = Puppet::String::OptionBuilder.build(@action, *declaration, &block) + @action.add_option(option) + end end |