Class: Puppet::DataProviders::DataAdapter 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.

A DataAdapter adapts an object with a Hash of data

Direct Known Subclasses

LookupAdapter

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

Constants inherited from Pops::Adaptable::Adapter

Pops::Adaptable::Adapter::DOUBLE_COLON, Pops::Adaptable::Adapter::USCORE

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.



13
14
15
# File 'lib/puppet/data_providers/data_adapter.rb', line 13

def initialize
  @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.



7
8
9
# File 'lib/puppet/data_providers/data_adapter.rb', line 7

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.



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

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.



17
18
19
# File 'lib/puppet/data_providers/data_adapter.rb', line 17

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.



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

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)


21
22
23
# File 'lib/puppet/data_providers/data_adapter.rb', line 21

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