Sha256: aa47c27421543e9ea92e0a86e9e888d68551e1965205d11328be19bea477686f

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

require_relative './base'
require_relative '../errors'

module RakeSecrets
  module Storage
    class InMemory < Base
      def initialize(opts = {})
        super()
        @persistence = opts[:contents] || {}
      end

      def store(path, content)
        @persistence[path] = content
      end

      def remove(path)
        @persistence.delete(path)
      end

      def retrieve(path)
        unless @persistence.include?(path)
          raise(Errors::NoSuchPathError, "Path '#{path}' not in storage.")
        end

        @persistence[path]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake_secrets-0.1.0.pre.4 lib/rake_secrets/storage/in_memory.rb