Sha256: bfa8747b2475ff41b7efd5ad0f5d547217575607cbb4191d09dbc04496a9d9c2

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

module Chambermaid
  class Namespace
    # @param [String] path
    # @param [Boolean] overload
    def initialize(path:, overload: false)
      @path = path
      @overload = overload

      @store = ParameterStore.new(path: path)
      @env = Environment.new({})
    end

    def self.load!(path:, overload: false)
      namespace = new(path: path, overload: overload)
      namespace.load!
      namespace
    end

    def load!
      @store.load!
      load_env!
    end

    def reload!
      @env.unload!
      @store.reload!
      load_env!
    end

    def unload!
      @env.unload!
    end

    private

    # Inject into ENV
    def load_env!
      @env.replace(@store.params)
      @overload ? @env.overload! : @env.load!
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chambermaid-0.3.2 lib/chambermaid/namespace.rb
chambermaid-0.3.1 lib/chambermaid/namespace.rb
chambermaid-0.3.0 lib/chambermaid/namespace.rb