module R10K::Settings::Helpers::InstanceMethods

Public Instance Methods

parent() click to toggle source
# File lib/r10k/settings/helpers.rb, line 29
def parent
  @parent
end
parent=(new_parent) click to toggle source

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

@param new_parent [R10K::Settings::Collection] Parent collection

# 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