Sha256: f2eec82d15b7959a67a15596446e76a646635103e48cb973be32930b2dc504ee
Contents?: true
Size: 688 Bytes
Versions: 4
Compression:
Stored size: 688 Bytes
Contents
module Blueprints class Namespace < Buildable cattr_accessor :root delegate :empty?, :size, :to => :@children def initialize(name) super(name) @children = {} end def add_child(child) #TODO: Raise error for duplicate children! @children[child.name] = child child.namespace = self end def [](path) child_name, path = path.to_s.split('.', 2) child = @children[child_name.to_sym] or raise PlanNotFoundError, child_name if path child[path] else child end end def build_plan Namespace.root.add_variable(path, @children.collect {|p| p.last.build }.uniq) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
blueprints-0.3.4 | lib/blueprints/namespace.rb |
blueprints-0.3.3 | lib/blueprints/namespace.rb |
blueprints-0.3.2 | lib/blueprints/namespace.rb |
blueprints-0.3.1 | lib/blueprints/namespace.rb |