Class: Puppet::DataProviders::DataAdapter Deprecated Private

Inherits:
Pops::Adaptable::Adapter show all
Includes:
Plugins::DataProviders
Defined in:
lib/puppet/data_providers/data_adapter.rb

Overview

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

Deprecated.

A DataAdapter adapts an object with a Hash of data

TODO: API 5.0, remove this class

Constant Summary

Constants included from Plugins::DataProviders

Plugins::DataProviders::ENV_DATA_PROVIDERS_KEY, Plugins::DataProviders::ENV_DATA_PROVIDERS_TYPE, Plugins::DataProviders::MODULE_DATA_PROVIDERS_KEY, Plugins::DataProviders::MODULE_DATA_PROVIDERS_TYPE, Plugins::DataProviders::PATH_BASED_DATA_PROVIDER_FACTORIES_KEY, Plugins::DataProviders::PATH_BASED_DATA_PROVIDER_FACTORIES_TYPE, Plugins::DataProviders::PER_MODULE_DATA_PROVIDER_KEY, Plugins::DataProviders::PER_MODULE_DATA_PROVIDER_TYPE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pops::Adaptable::Adapter

adapt, adapt_new, associate_adapter, clear, get, instance_var_name, self_attr_name

Constructor Details

#initializeDataAdapter

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.

Returns a new instance of DataAdapter.



15
16
17
18
19
20
21
# File 'lib/puppet/data_providers/data_adapter.rb', line 15

def initialize
  unless Puppet[:strict] == :off
    Puppet.warn_once(:deprecation, 'Puppet::DataProviders::DataAdapter',
      'Puppet::DataProviders::DataAdapter is deprecated and will be removed in the next major version of Puppet')
  end
  @data = {}
end

Instance Attribute Details

#dataObject

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.



9
10
11
# File 'lib/puppet/data_providers/data_adapter.rb', line 9

def data
  @data
end

Class Method Details

.create_adapter(o) ⇒ 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.



11
12
13
# File 'lib/puppet/data_providers/data_adapter.rb', line 11

def self.create_adapter(o)
  new
end

Instance Method Details

#[](name) ⇒ 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.



23
24
25
# File 'lib/puppet/data_providers/data_adapter.rb', line 23

def [](name)
  @data[name]
end

#[]=(name, value) ⇒ 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.



31
32
33
34
35
36
# File 'lib/puppet/data_providers/data_adapter.rb', line 31

def []=(name, value)
  unless value.is_a?(Hash)
    raise ArgumentError, "Given value must be a Hash, got: #{value.class}."
  end
  @data[name] = value
end

#has_name?(name) ⇒ Boolean

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.

Returns:

  • (Boolean)


27
28
29
# File 'lib/puppet/data_providers/data_adapter.rb', line 27

def has_name?(name)
  @data.has_key? name
end