Sha256: c5feb7f60a32f6ffea5c8dcf81c2259e01319bb62d1579c055b0338e17ad1fb6
Contents?: true
Size: 709 Bytes
Versions: 14
Compression:
Stored size: 709 Bytes
Contents
require 'puppet/indirector/terminus' # Manage a memory-cached list of instances. class Puppet::Indirector::Memory < Puppet::Indirector::Terminus def initialize @instances = {} end def destroy(request) raise ArgumentError.new("Could not find #{request.key} to destroy") unless @instances.include?(request.key) @instances.delete(request.key) end def find(request) @instances[request.key] end def search(request) found_keys = @instances.keys.find_all { |key| key.include?(request.key) } found_keys.collect { |key| @instances[key] } end def head(request) not find(request).nil? end def save(request) @instances[request.key] = request.instance end end
Version data entries
14 entries across 14 versions & 1 rubygems