lib/chambermaid/namespace.rb in chambermaid-0.5.4 vs lib/chambermaid/namespace.rb in chambermaid-0.5.5

- old
+ new

@@ -1,6 +1,8 @@ module Chambermaid + # Namespaces each contain a ParameterStore and Environment instance, + # along with the overload flag class Namespace # @param [String] path # @param [Boolean] overload def initialize(path:, overload: false) @path = path @@ -8,26 +10,48 @@ @store = ParameterStore.new(path: path) @env = Environment.new({}) end + # Create a namespace and immediately fetch and inject params to ENV + # + # @see Chambermaid::Namespace.load! + # + # @param [String] path + # @param [Boolean] overload + # + # @return [Chambermaid::Namespace] def self.load!(path:, overload: false) namespace = new(path: path, overload: overload) namespace.load! namespace end + # Load ParameterStore and inject into ENV + # + # @see Chambermaid::ParameterStore#load! + # @see Chambermaid::Environment#load! + # @see Chambermaid::Environment#overload! def load! @store.load! load_env! end + # Unload params from ENV, reload ParameterStore, and inject into ENV + # + # @see Chambermaid::Environment#unload! + # @see Chambermaid::ParameterStore#reload! + # @see Chambermaid::Environment#load! + # @see Chambermaid::Environment#overload! def reload! @env.unload! @store.reload! load_env! end + # Unload params from ENV + # + # @see Chambermaid::Environment#unload! def unload! @env.unload! Chambermaid.logger.info("unloaded #{@env.size} params from ENV") end