diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 14:34:51 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 14:35:13 -0700 |
commit | 4d2a367b0cf5bf03588b1e6bbfafdf437bea249e (patch) | |
tree | 6f731f99d1e0e51ee4ba613851cc49b90633b27f /lib/puppet/string/action_builder.rb | |
parent | 75ef3af26fcd205f316358b2f23abe5e200f6eaf (diff) | |
download | puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.tar.gz puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.tar.xz puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.zip |
(#6964) use 'when_invoked' rather than 'invoke' for actions.
In the DSL we want to use 'when_invoked do' because it reads much more
naturally for users.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'lib/puppet/string/action_builder.rb')
-rw-r--r-- | lib/puppet/string/action_builder.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/string/action_builder.rb b/lib/puppet/string/action_builder.rb index e76044470..e7c03273b 100644 --- a/lib/puppet/string/action_builder.rb +++ b/lib/puppet/string/action_builder.rb @@ -9,6 +9,7 @@ class Puppet::String::ActionBuilder new(string, name, &block).action end + private def initialize(string, name, &block) @string = string @action = Puppet::String::Action.new(string, name) @@ -18,9 +19,9 @@ class Puppet::String::ActionBuilder # Ideally the method we're defining here would be added to the action, and a # method on the string would defer to it, but we can't get scope correct, # so we stick with this. --daniel 2011-03-24 - def invoke(&block) - raise "Invoke called on an ActionBuilder with no corresponding Action" unless @action - @action.invoke = block + def when_invoked(&block) + raise "when_invoked on an ActionBuilder with no corresponding Action" unless @action + @action.when_invoked = block end def option(*declaration, &block) |