Implement a key/value registry at env level

This commit is contained in:
Thibault Jouan
2014-01-21 17:10:42 +00:00
parent d845af60a3
commit 154ee8d534
2 changed files with 33 additions and 5 deletions

View File

@@ -1,18 +1,27 @@
module Producer
module Core
class Env
attr_reader :input, :output
attr_reader :input, :output, :registry
attr_accessor :target
def initialize(input: $stdin, output: $stdout)
@input = input
@output = output
@target = nil
def initialize(input: $stdin, output: $stdout, registry: {})
@input = input
@output = output
@target = nil
@registry = registry
end
def remote
@remote ||= Remote.new(target)
end
def [](key)
@registry[key]
end
def []=(key, value)
@registry[key] = value
end
end
end
end