Class: DTK::DSL::Template::V1::Dependency

Inherits:
DTK::DSL::Template::V1 show all
Defined in:
lib/dsl/template/v1/dependency.rb

Constant Summary collapse

MODULE_NAMESPACE_DELIMS =
['/', ':']

Constants inherited from DTK::DSL::Template::V1

VERSION

Instance Attribute Summary

Attributes included from NestedDSLFile::Mixin

#nested_file_content

Attributes included from Generation::Mixin

#filter, #top

Attributes included from Parsing::Mixin

#file_obj, #parent_key

Class Method Summary collapse

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, #empty_input_hash, #file_parser_output_array, #file_parser_output_hash, #parse_element, #parse_elements

Methods included from Generation::ClassMixin

#generate_elements

Methods included from Generation::Mixin

#generate!, #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, #parsing_error

Constructor Details

This class inherits a constructor from DTK::DSL::Template

Class Method Details

.parse_elements(input_hash, parent_info) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/dsl/template/v1/dependency.rb', line 28

def self.parse_elements(input_hash, parent_info)
  ret = file_parser_output_array
  input_hash.each do |name, version|
    ret << parse_element({ 'name' => name, 'version' => version }, parent_info, :index => name)
  end
  ret
end

Instance Method Details

#parse!Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dsl/template/v1/dependency.rb', line 36

def parse!
  name = input_hash['name']
  version = input_hash['version']

  split = split_by_delim(name)
  unless split.size == 2
    raise parsing_error("The term '#{input_string}' is an ill-formed module reference")
  end
  namespace, module_name = split

  set :Namespace, namespace
  set :ModuleName, module_name
  set :ModuleVersion, version
end

#parser_output_typeObject



24
25
26
# File 'lib/dsl/template/v1/dependency.rb', line 24

def parser_output_type
  :hash
end