Sha256: 38ef41abde40ec620a6d032c386455a2cf8d92b11c99f597a273fe428c6be8da
Contents?: true
Size: 811 Bytes
Versions: 12
Compression:
Stored size: 811 Bytes
Contents
# frozen_string_literal: true require_relative '../../puppet/indirector/terminus' # Manage a memory-cached list of instances. class Puppet::Indirector::Memory < Puppet::Indirector::Terminus def initialize clear end def clear @instances = {} end def destroy(request) raise ArgumentError.new(_("Could not find %{request} to destroy") % { request: request.key }) 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
12 entries across 12 versions & 1 rubygems