Implement a key/value registry at env level
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user