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

- old
+ new

@@ -1,6 +1,11 @@ module Chambermaid + # Environment keeps a set of params available to load into ENV. It also + # maintains a copy of ENV at the time of its initialization, in order to + # restore it. + # + # @attr_reader [Hash] params class Environment < Hash attr_reader :params # Create new Chambermaid::Environment # @@ -33,19 +38,25 @@ f.write(to_dotenv) end end # Inject into ENV without overwriting duplicates + # + # @return [Hash] def load! each { |k, v| ENV[k] ||= v } end # Inject into ENV and overwrite duplicates + # + # @return [Hash] def overload! each { |k, v| ENV[k] = v } end # Restore to original ENV + # + # @return [ENV] def unload! ENV.replace(@_original_env) end private