Sha256: 60929a8889fbac68f870af463307933496358ea7ba1cc35a860ba1bb32117c97
Contents?: true
Size: 572 Bytes
Versions: 1
Compression:
Stored size: 572 Bytes
Contents
module Egi class Env def initialize(name) @name = name end def merge!(other) other = (other.is_a?(Env) ? other.items : other) # because items has default proc and cannnot dump items.merge!(Marshal.load(Marshal.dump(Hash[other]))) end def group(name = nil, &block) items.merge!(Class.new(Group).new(name).instance_eval(&block).items) end def items @items ||= Hash.new {|hash, key| hash[key] = Item[:name => key] } end def item(name, hash) items[name.to_sym].update(hash) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
egi-0.0.2 | lib/egi/env.rb |