Class: PuppetX::Puppetlabs::Migration::CatalogDeltaModel::Attribute

Inherits:
Diff
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb

Overview

A Resource Attribute. Attributes stems from parameters, and information encoded in the resource (i.e. ‘exported` or `tags`)

Constant Summary collapse

SET_ATTRIBUTES =
%w(before after subscribe notify tags).freeze

Instance Attribute Summary collapse

Attributes inherited from Diff

#diff_id

Instance Method Summary collapse

Methods inherited from Diff

#assign_ids

Methods inherited from DeltaEntity

from_hash

Methods included from ModelObject

#initialize_from_hash, #to_hash

Constructor Details

#initialize(name, value) ⇒ Attribute

Returns a new instance of Attribute.

Parameters:

  • name (String)

    the attribute name

  • value (Object)

    the attribute value



125
126
127
128
129
130
131
132
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 125

def initialize(name, value)
  @name = assert_type(String, name)
  if SET_ATTRIBUTES.include?(name)
    value = [value] unless value.is_a?(Array)
    value = Set.new(value)
  end
  @value = value
end

Instance Attribute Details

#nameObject (readonly)



116
117
118
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 116

def name
  @name
end

#valueObject (readonly)



121
122
123
# File 'lib/puppet_x/puppetlabs/migration/catalog_delta_model.rb', line 121

def value
  @value
end