Sha256: cab173b539541fc85e59c0e89ff19972aa9ecdb4e6e803ffa0dd3f791802ed62
Contents?: true
Size: 830 Bytes
Versions: 3
Compression:
Stored size: 830 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 attr_reader :children delegate :empty?, :size, :to => :@children def initialize(name) super(name) @children = {} end def add_child(child) @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_self(build_once = true) Namespace.root.add_variable(path, @children.collect {|p| p.last.build }.uniq) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blueprints-0.6.2 | lib/blueprints/namespace.rb |
blueprints-0.6.1 | lib/blueprints/namespace.rb |
blueprints-0.6.0 | lib/blueprints/namespace.rb |