Class: Builderator::Config::Attributes::Namespace
- Inherits:
-
Builderator::Config::Attributes
- Object
- Builderator::Config::Attributes
- Builderator::Config::Attributes::Namespace
- Defined in:
- lib/builderator/config/attributes.rb
Overview
Define a namespace for attributes
Class Attribute Summary collapse
-
.name ⇒ Object
Returns the value of attribute name.
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Builderator::Config::Attributes
#attributes, #extends, #nodes, #parent
Class Method Summary collapse
-
.create(namespace_name, &definition) ⇒ Object
Construct a new child-class to define the interface.
Instance Method Summary collapse
-
#initialize(attributes, options = {}, &block) ⇒ Namespace
constructor
A new instance of Namespace.
Methods inherited from Builderator::Config::Attributes
#==, attribute, #clean, collection, #compile, #dirty, #dirty!, #merge, namespace, #reset!, #root, #root?, #seal, #to_json, #unseal
Constructor Details
#initialize(attributes, options = {}, &block) ⇒ Namespace
Returns a new instance of Namespace.
300 301 302 303 304 305 |
# File 'lib/builderator/config/attributes.rb', line 300 def initialize(attributes, = {}, &block) super(attributes, , &block) @name = .fetch(:name, self.class.name) @collection = [:collection] end |
Class Attribute Details
.name ⇒ Object
Returns the value of attribute name.
279 280 281 |
# File 'lib/builderator/config/attributes.rb', line 279 def name @name end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
298 299 300 |
# File 'lib/builderator/config/attributes.rb', line 298 def collection @collection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
297 298 299 |
# File 'lib/builderator/config/attributes.rb', line 297 def name @name end |
Class Method Details
.create(namespace_name, &definition) ⇒ Object
Construct a new child-class to define the interface. The constructor accepts an attributes argument, which should be a sub-node of the root attribute-set.
286 287 288 289 290 291 292 293 294 |
# File 'lib/builderator/config/attributes.rb', line 286 def create(namespace_name, &definition) space = Class.new(self) space.name = namespace_name ## Define DSL interface space.instance_eval(&definition) if definition space end |