Class: DTK::DSL::Template::V1::Node
- Inherits:
-
DTK::DSL::Template::V1
- Object
- DTK::DSL::Template
- DTK::DSL::Template::V1
- DTK::DSL::Template::V1::Node
- Defined in:
- lib/dsl/template/v1/node.rb,
lib/dsl/template/v1/node/semantic_parse.rb
Defined Under Namespace
Modules: Constant Classes: SemanticParse
Constant Summary
Constants inherited from DTK::DSL::Template::V1
Instance Attribute Summary
Attributes included from NestedDSLFile::Mixin
Attributes included from Generation::Mixin
Attributes included from Parsing::Mixin
Class Method Summary collapse
-
.elements_collection_type ⇒ Object
For parsing.
-
.generate_elements(nodes_content, parent) ⇒ Object
For generation.
- .parse_elements(input_hash, parent_info) ⇒ Object
Instance Method Summary collapse
Methods inherited from DTK::DSL::Template::V1
#dsl_version, #template_version
Methods inherited from DTK::DSL::Template
#add, create_for_generation, create_for_parsing, #initialize, #merge, #req, #set, #set?, #val
Methods included from Parsing::ClassMixin
#elements_collection_type, #file_parser_output_array, #file_parser_output_hash, #parse_element, #parse_elements
Methods included from Generation::ClassMixin
Methods included from Generation::Mixin
#generate?, #generate_yaml_file_path__content_array, #generate_yaml_object, #generate_yaml_object?, #generate_yaml_text, #yaml_object_type
Methods included from Parsing::Mixin
#parse, #parser_output_type, #parsing_error
Constructor Details
This class inherits a constructor from DTK::DSL::Template
Class Method Details
.elements_collection_type ⇒ Object
For parsing
33 34 35 |
# File 'lib/dsl/template/v1/node.rb', line 33 def self.elements_collection_type :hash end |
.generate_elements(nodes_content, parent) ⇒ Object
For generation
49 50 51 52 53 54 |
# File 'lib/dsl/template/v1/node.rb', line 49 def self.generate_elements(nodes_content, parent) nodes_content.inject({}) do |h, (name, node)| node_hash = generate_element?(node, parent) node_hash ? h.merge(name => node_hash) : h end end |
.parse_elements(input_hash, parent_info) ⇒ Object
37 38 39 40 41 |
# File 'lib/dsl/template/v1/node.rb', line 37 def self.parse_elements(input_hash, parent_info) input_hash.inject(file_parser_output_hash) do |h, (name, content)| h.merge(name => parse_element(content, parent_info, :index => name)) end end |
Instance Method Details
#generate! ⇒ Object
56 57 58 |
# File 'lib/dsl/template/v1/node.rb', line 56 def generate! merge(generate_node_hash) end |
#parse! ⇒ Object
43 44 45 46 |
# File 'lib/dsl/template/v1/node.rb', line 43 def parse! set? :Attributes, parse_child_elements?(:node_attribute, :Attributes) set? :Components, parse_child_elements?(:component, :Components) end |