Method: Puppet::Interface::ActionBuilder#when_rendering
- Defined in:
- lib/puppet/interface/action_builder.rb
#when_rendering(type = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO:
this needs more
Sets a block to be run at the rendering stage, for a specific rendering type (eg JSON, YAML, console), after the block for when_invoked gets run. This manipulates the value returned by the action. It makes it possible to work around limitations in the underlying object returned, and should be avoided in favor of returning a more capable object.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/puppet/interface/action_builder.rb', line 63 def when_rendering(type = nil, &block) if type.nil? then # the default error message sucks --daniel 2011-04-18 # TRANSLATORS 'when_rendering' is a method name and should not be translated raise ArgumentError, _('You must give a rendering format to when_rendering') end if block.nil? then # TRANSLATORS 'when_rendering' is a method name and should not be translated raise ArgumentError, _('You must give a block to when_rendering') end @action.set_rendering_method_for(type, block) end |