Module: Puppet::Pops::Adaptable Private

Included in:
Binder::Bindings::BindingsModelObject, Model::PopsObject, Types::TypedModelObject
Defined in:
lib/puppet/pops/adaptable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Note:

the implementation details; the fact that an instance variable is used to keep the adapter instance data should not be exploited as the implementation of _being adaptable_ may change in the future.

Adaptable is a mix-in module that adds adaptability to a class. This means that an adapter can associate itself with an instance of the class and store additional data/have behavior.

This mechanism should be used when there is a desire to keep implementation concerns separate. In Ruby it is always possible to open and modify a class or instance to teach it new tricks, but it is however not possible to do this for two different versions of some service at the same time. The Adaptable pattern is also good when only a few of the objects of some class needs to have extra information (again possible in Ruby by adding instance variables dynamically). In fact, the implementation of Adaptable does just that; it adds an instance variable named after the adapter class and keeps an instance of this class in this slot.

Defined Under Namespace

Classes: Adapter