Sha256: 46da24c5b1a9f6956db63c4e8bd97af9a094b15a8f9b7e49b2f020847515d805

Contents?: true

Size: 779 Bytes

Versions: 120

Compression:

Stored size: 779 Bytes

Contents

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

120 entries across 120 versions & 1 rubygems

Version Path
puppet-7.34.0 lib/puppet/indirector/memory.rb
puppet-7.34.0-x86-mingw32 lib/puppet/indirector/memory.rb
puppet-7.34.0-x64-mingw32 lib/puppet/indirector/memory.rb
puppet-7.34.0-universal-darwin lib/puppet/indirector/memory.rb
puppet-7.33.0 lib/puppet/indirector/memory.rb
puppet-7.33.0-x86-mingw32 lib/puppet/indirector/memory.rb
puppet-7.33.0-x64-mingw32 lib/puppet/indirector/memory.rb
puppet-7.33.0-universal-darwin lib/puppet/indirector/memory.rb
puppet-7.32.1 lib/puppet/indirector/memory.rb
puppet-7.32.1-x86-mingw32 lib/puppet/indirector/memory.rb
puppet-7.32.1-x64-mingw32 lib/puppet/indirector/memory.rb
puppet-7.32.1-universal-darwin lib/puppet/indirector/memory.rb
puppet-7.31.0 lib/puppet/indirector/memory.rb
puppet-7.31.0-x86-mingw32 lib/puppet/indirector/memory.rb
puppet-7.31.0-x64-mingw32 lib/puppet/indirector/memory.rb
puppet-7.31.0-universal-darwin lib/puppet/indirector/memory.rb
puppet-7.30.0 lib/puppet/indirector/memory.rb
puppet-7.30.0-x86-mingw32 lib/puppet/indirector/memory.rb
puppet-7.30.0-x64-mingw32 lib/puppet/indirector/memory.rb
puppet-7.30.0-universal-darwin lib/puppet/indirector/memory.rb