Sha256: 9f6c29e185595b26c605193d075bc1a863c10360ca68c8399db96ffcd28a1c1c
Contents?: true
Size: 834 Bytes
Versions: 5
Compression:
Stored size: 834 Bytes
Contents
module Blueprints # Namespace class, inherits from <tt>Buildable</tt>. Allows adding and finding child blueprints/namespaces and building # all it's children. 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
5 entries across 5 versions & 1 rubygems