Sha256: b860bb86afc63f04dc60af2878ea8a6f5cbf088dd672030a32a9b5b97fef4002
Contents?: true
Size: 584 Bytes
Versions: 1
Compression:
Stored size: 584 Bytes
Contents
module Egi class Sandbox def initialize @current_env = :default end def envs @envs ||= Hash.new {|hash, key| hash[key] = Env.new(key) } end def env(name, opts = {}, &block) name = name.to_sym @current_env = name to_load = opts[:load] envs[name].merge!(envs[to_load]) if envs.has_key?(to_load) envs[name].instance_eval(&block) if block_given? end def eval(str) instance_eval(str) envs end def method_missing(name, *args) envs[@current_env].send(name, *args) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
egi-0.0.1 | lib/egi/sandbox.rb |