Class: Qor::Dsl::Config
- Inherits:
-
Object
- Object
- Qor::Dsl::Config
- Defined in:
- lib/qor_dsl/config.rb
Instance Attribute Summary collapse
-
#__block ⇒ Object
Returns the value of attribute __block.
-
#__children ⇒ Object
Returns the value of attribute __children.
-
#__name ⇒ Object
Returns the value of attribute __name.
-
#__node ⇒ Object
Returns the value of attribute __node.
-
#__options ⇒ Object
Returns the value of attribute __options.
-
#__parent ⇒ Object
Returns the value of attribute __parent.
Instance Method Summary collapse
- #__add_child(type, options, child) ⇒ Object
-
#initialize(type, node = nil) ⇒ Config
constructor
A new instance of Config.
- #inspect ⇒ Object
- #node(type, options = {}, &blk) ⇒ Object
Constructor Details
#initialize(type, node = nil) ⇒ Config
Returns a new instance of Config.
6 7 8 9 |
# File 'lib/qor_dsl/config.rb', line 6 def initialize type, node=nil self.__name = type self.__node = node end |
Instance Attribute Details
#__block ⇒ Object
Returns the value of attribute __block.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def __block @__block end |
#__children ⇒ Object
Returns the value of attribute __children.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def __children @__children end |
#__name ⇒ Object
Returns the value of attribute __name.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def __name @__name end |
#__node ⇒ Object
Returns the value of attribute __node.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def __node @__node end |
#__options ⇒ Object
Returns the value of attribute __options.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def @__options end |
#__parent ⇒ Object
Returns the value of attribute __parent.
4 5 6 |
# File 'lib/qor_dsl/config.rb', line 4 def __parent @__parent end |
Instance Method Details
#__add_child(type, options, child) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/qor_dsl/config.rb', line 23 def __add_child(type, , child) child.__parent = self child. = self.__children[type.to_sym] = child method_defination = <<-DOC def #{type}(name=nil, *data, &blk) config = __children['#{type}'.to_sym] node = Qor::Dsl::Node.new(name) node.add_config(config) node.data = data node.block = blk __node.add_child(node) node.config.instance_eval(&blk) if block_given? && (config.__children.size > 0) end DOC self.instance_eval method_defination end |
#inspect ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/qor_dsl/config.rb', line 43 def inspect = { 'name' => __name, 'parent' => __parent && __parent.__name, 'children' => __children.keys, 'options' => , 'block' => __block } Qor::Dsl.inspect_object(self, ) end |