Thibault Jouan 513ba4eedb Implement basic Remote::Environment class:
Represent a registry for remote environment variables, will follow an
API similar to Hash except the constructor. Currently only #has_key? is
implemented.
2013-08-20 02:13:54 +00:00

28 lines
541 B
Ruby

module Producer
module Core
class Remote
class Environment
require 'forwardable'
extend Forwardable
def_delegator :@variables, :has_key?
def initialize(variables)
case variables
when String
@variables = parse_from_string variables
else
@variables = variables
end
end
private
def parse_from_string(str)
Hash[str.each_line.map { |l| l.chomp.split '=', 2 }]
end
end
end
end
end