Class: CemAcpt::NodeData

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/cem_acpt/shared_objects.rb

Overview

Provides an object to hold NodeData configs. Not thread-safe. Should not be mutated by itself, but can be mutated safely by the NodeInventory object. Currently unused.

Constant Summary

Constants included from Logging

Logging::LEVEL_MAP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

current_log_config, #current_log_config, current_log_format, #current_log_format, current_log_level, #current_log_level, included, logger, #logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, new_log_level, #new_log_level, new_logger, #new_logger

Constructor Details

#initialize(name, data) ⇒ NodeData

Returns a new instance of NodeData.



142
143
144
145
146
# File 'lib/cem_acpt/shared_objects.rb', line 142

def initialize(name, data)
  data.format!
  @name = name
  @opts = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



140
141
142
# File 'lib/cem_acpt/shared_objects.rb', line 140

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



140
141
142
# File 'lib/cem_acpt/shared_objects.rb', line 140

def name
  @name
end

Instance Method Details

#deep_merge(other) ⇒ Object



148
149
150
# File 'lib/cem_acpt/shared_objects.rb', line 148

def deep_merge(other)
  @opts.deep_merge(other.to_h)
end

#dot_dig(dot_key) ⇒ Object



152
153
154
# File 'lib/cem_acpt/shared_objects.rb', line 152

def dot_dig(dot_key)
  @opts.dot_dig(dot_key)
end

#dot_store(dot_key, value) ⇒ Object



156
157
158
# File 'lib/cem_acpt/shared_objects.rb', line 156

def dot_store(dot_key, value)
  @opts.dot_store(dot_key, value)
end

#to_hObject



160
161
162
# File 'lib/cem_acpt/shared_objects.rb', line 160

def to_h
  @opts
end

#to_json(*args) ⇒ Object



168
169
170
# File 'lib/cem_acpt/shared_objects.rb', line 168

def to_json(*args)
  to_h.to_json(*args)
end

#to_yamlObject



164
165
166
# File 'lib/cem_acpt/shared_objects.rb', line 164

def to_yaml
  to_h.to_yaml
end