class Octofacts::Manipulators::Replace

Public Class Methods

execute(facts, *args, &_block) click to toggle source

Public: Executor for the .replace command.

Sets the fact to the specified value. If the fact didn't exist before, it's created.

facts - Hash of current facts args - Arguments, here consisting of an array of hashes with replacement parameters

# File lib/octofacts/manipulators/replace.rb, line 12
def self.execute(facts, *args, &_block)
  args.each do |arg|
    raise ArgumentError, "Must pass a hash of target facts to .replace - got #{arg}" unless arg.is_a?(Hash)
    arg.each { |key, val| set(facts, key, val) }
  end
end