Sha256: a3852f963bf557bff51c40941eb8bc935777147bf9361d126a7581eb7c907678

Contents?: true

Size: 338 Bytes

Versions: 4

Compression:

Stored size: 338 Bytes

Contents

module Psenv
  class Environment
    def initialize(*variables)
      @variables = variables.reverse.reduce({}, :merge)
    end

    def apply
      @variables.each do |k, v|
        ENV.store(k.to_s, v) unless ENV.has_key?(k.to_s)
      end
    end

    def apply!
      @variables.each { |k, v| ENV.store(k.to_s, v) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
psenv-0.7.0 lib/psenv/environment.rb
psenv-0.6.0 lib/psenv/environment.rb
psenv-0.4.0 lib/psenv/environment.rb
psenv-0.3.0 lib/psenv/environment.rb