Module: PEBuild::Util::Config

Defined in:
lib/pe_build/util/config.rb

Class Method Summary collapse

Class Method Details

.local_merge(local, other) ⇒ Vagrant::Plugin::V2::Config

Merge configuration classes together with the "local" object overwriting any values set in the "other" object. This uses the default merging in the Vagrant plugin config class. The builtin merge function is not straight forward however. It needs to be called on the object being overwritten. When using a subclass of a global config for a provisioner config, the builtin merge method cannot actually merge them in the direction that would be needed.

This function assumes that the "local" object is of the same class or at the very least a subclass of "other".

Parameters:

  • local (Vagrant::Plugin::V2::Config)

    Local configuration class to merge

  • other (Vagrant::Plugin::V2::Config)

    Other configuration class to merge

Returns:

  • (Vagrant::Plugin::V2::Config)

    New object of the same class as Local that represents the merged result



19
20
21
22
23
24
25
26
# File 'lib/pe_build/util/config.rb', line 19

def self.local_merge(local, other)
  if other.class >= local.class
    result = local.class.new

    result = result.merge(other)
    result = result.merge(local)
  end
end