module DTK::DSL::Template::NestedDSLFile::Mixin
Attributes
nested_file_content[R]
Private Instance Methods
add_import_statement!(nested_dsl_file, yaml_object = nil)
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 54 def add_import_statement!(nested_dsl_file, yaml_object = nil) yaml_object ||= empty_yaml_object(:output_type => :hash) set_generation_hash(yaml_object, :Import, nested_dsl_file) yaml_object end
add_nested_dsl_file_import?(nested_dsl_file)
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 42 def add_nested_dsl_file_import?(nested_dsl_file) unless val(:HiddenImportStatement) if @yaml_object.kind_of?(::Hash) add_import_statement!(nested_dsl_file, @yaml_object) elsif @yaml_object.kind_of?(::Array) @yaml_object << add_import_statement!(nested_dsl_file) else raise Error, "Unexpected that @yaml_object is not a hash or array" end end end
empty_nested_dsl_file_hash(nested_dsl_file, output_type)
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 69 def empty_nested_dsl_file_hash(nested_dsl_file, output_type) @top.nested_file_content[nested_dsl_file] ||= empty_yaml_object(output_type: output_type) end
generate_nested_dsl_file_path__content_array()
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 31 def generate_nested_dsl_file_path__content_array @nested_file_content.inject([]) do |a, (path, content)| a + [{ :path => path, :content => YamlHelper.generate(content) }] end end
generation_initialize_nested_dsl_files()
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 25 def generation_initialize_nested_dsl_files # If there iis any nested dsl in conetnt being generated then tese wil go on @nested_file_content # which has keys that are relative paths and values being @nested_file_content = {} end
nested_dsl_file?()
click to toggle source
returns the path of a file if @yaml_object should be written to a nested dsl file
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 38 def nested_dsl_file? val(:Import) end
select_yaml_object_or_nested_dsl_file()
click to toggle source
# File lib/dsl/template/nested_dsl_file/mixin.rb, line 60 def select_yaml_object_or_nested_dsl_file if nested_dsl_file = nested_dsl_file? add_nested_dsl_file_import?(nested_dsl_file) empty_nested_dsl_file_hash(nested_dsl_file, InputOutputCommon.obj_type(@yaml_object)) else @yaml_object end end