Class: DTK::DSL::ServiceAndComponentInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl/service_and_component_info.rb,
lib/dsl/service_and_component_info/info.rb,
lib/dsl/service_and_component_info/parser.rb,
lib/dsl/service_and_component_info/module_ref.rb,
lib/dsl/service_and_component_info/transform_to.rb,
lib/dsl/service_and_component_info/transform_from.rb,
lib/dsl/service_and_component_info/transform_from/parser/top_dsl/dependencies.rb

Direct Known Subclasses

TransformFrom, TransformTo

Defined Under Namespace

Classes: Info, ModuleRef, Parser, TransformFrom, TransformTo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, module_name, version = nil) ⇒ ServiceAndComponentInfo

Returns a new instance of ServiceAndComponentInfo.



29
30
31
32
33
34
# File 'lib/dsl/service_and_component_info.rb', line 29

def initialize(namespace, module_name, version = nil)
  @module_ref = ModuleRef.new(namespace, module_name, version)

  # dynamically computed
  @output_path_hash_pairs = {} 
end

Instance Attribute Details

#module_refObject (readonly)

Returns the value of attribute module_ref.



28
29
30
# File 'lib/dsl/service_and_component_info.rb', line 28

def module_ref
  @module_ref
end

#output_path_hash_pairsObject (readonly)

Returns the value of attribute output_path_hash_pairs.



28
29
30
# File 'lib/dsl/service_and_component_info.rb', line 28

def output_path_hash_pairs
  @output_path_hash_pairs
end

Instance Method Details

#info_processor(info_type) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/dsl/service_and_component_info.rb', line 36

def info_processor(info_type)
  case info_type 
  when :service_info then self.class::Info::Service.new(self)
  when :component_info then self.class::Info::Component.new(self)
  else
    fail Error, "Unexpected info_type '#{info_type}'"
  end
end

#output_path_text_pairsObject



45
46
47
# File 'lib/dsl/service_and_component_info.rb', line 45

def output_path_text_pairs
  @output_path_hash_pairs.inject({}) { |h, (path, hash_content)| h.merge(path => YamlHelper.generate(hash_content)) }
end

#update_or_add_output_hash!(path, hash_content) ⇒ Object



50
51
52
# File 'lib/dsl/service_and_component_info.rb', line 50

def update_or_add_output_hash!(path, hash_content)
  @output_path_hash_pairs.merge!(path => hash_content)
end