Method: Puppet::Pops::Adaptable::Adapter.adapt_new
- Defined in:
- lib/puppet/pops/adaptable.rb
.adapt_new(o) ⇒ Adapter<self> .adapt_new(o, {|adapter| block}) ⇒ Adapter<self> .adapt_new(o, {|adapter, o| block}) ⇒ Adapter<self>
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.
Creates a new adapter, associates it with the given object and returns the adapter.
This is used when a fresh adapter is wanted instead of possible returning an existing adapter as in the case of adapt.
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/puppet/pops/adaptable.rb', line 124 def self.adapt_new(o, &block) adapter = associate_adapter(create_adapter(o), o) if block_given? if block.arity == 1 block.call(adapter) else block.call(adapter, o) end end adapter end |