Sha256: 9703a8eee5856bf0b3d2813f1c606e866ff6322bbcc976fdd0e6b5c382207247

Contents?: true

Size: 334 Bytes

Versions: 3

Compression:

Stored size: 334 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.key?(k.to_s)
      end
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
psenv-0.9.1 lib/psenv/environment.rb
psenv-0.9.0 lib/psenv/environment.rb
psenv-0.8.0 lib/psenv/environment.rb