Class: DTK::DSL::Template::V1::Node::SemanticParse

Inherits:
InputOutputCommon::SemanticParse::Hash show all
Defined in:
lib/dsl/template/v1/node/semantic_parse.rb

Instance Method Summary collapse

Methods inherited from InputOutputCommon::SemanticParse::Hash

#initialize, #skip_for_generation?

Methods included from InputOutputCommon::SemanticParse::Mixin

#name, #qualified_key, #qualified_name

Methods inherited from InputOutputCommon::Canonical::Hash

#initialize, #remove_all_except!, #req, #set, #set?, #val

Methods inherited from InputOutputCommon::Hash

#initialize

Constructor Details

This class inherits a constructor from DTK::DSL::InputOutputCommon::SemanticParse::Hash

Instance Method Details

#attribute_value(attr_name) ⇒ Object



22
23
24
25
26
# File 'lib/dsl/template/v1/node/semantic_parse.rb', line 22

def attribute_value(attr_name)
  if attribute = attribute?(attr_name)
    value_from_attribute_object(attribute)
  end
end

#typeObject

possible values of type are :node or :node_group



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dsl/template/v1/node/semantic_parse.rb', line 29

def type
  type_value = attribute_value(:type)
  if type_value.nil?
    :node
  elsif type_value == 'group'
    :node_group
  else
    type_attribute = attribute(:type)
    fail Error::Usage, "The value '#{type_value}' assigned to attribute '#{type_attribute.qualified_name}' is not a legal node type"
  end
end