Module: R10K::Settings::Helpers::InstanceMethods

Defined in:
lib/r10k/settings/helpers.rb

Instance Method Summary collapse

Instance Method Details

#parentObject



29
30
31
# File 'lib/r10k/settings/helpers.rb', line 29

def parent
  @parent
end

#parent=(new_parent) ⇒ Object

Assign a parent collection to this setting. Parent may only be assigned once.

Parameters:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/r10k/settings/helpers.rb', line 17

def parent=(new_parent)
  unless @parent.nil?
    raise R10K::Error.new(_("%{class} instances cannot be reassigned to a new parent.") % {class: self.class} )
  end

  unless new_parent.is_a?(R10K::Settings::Collection) || new_parent.is_a?(R10K::Settings::List)
    raise R10K::Error.new(_("%{class} instances may only belong to a settings collection or list.") % {class: self.class} )
  end

  @parent = new_parent
end