class Envred
Constants
- VERSION
Public Class Methods
new(central, app)
click to toggle source
# File lib/envred.rb, line 5 def initialize(central, app) @central, @app = central, app @redis = Redis.new(url: "redis://#{@central}") end
Public Instance Methods
apply() { || ... }
click to toggle source
# File lib/envred.rb, line 14 def apply load.each do |key, val| if val == '' ENV.delete(key) else ENV[key] = val if ENV[key] === nil end end yield if block_given? end
load()
click to toggle source
# File lib/envred.rb, line 10 def load @redis.hgetall(@app) or [] end
purge()
click to toggle source
# File lib/envred.rb, line 34 def purge @redis.del(@app) end
set(*values)
click to toggle source
# File lib/envred.rb, line 26 def set(*values) @redis.hmset(@app, *values) end
unset(*keys)
click to toggle source
# File lib/envred.rb, line 30 def unset(*keys) @redis.hdel(@app, keys) end