class DTK::DSL::Template::V1::Node::SemanticParse

Public Instance Methods

attribute_value(attr_name) click to toggle source
# 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
type() click to toggle source

possible values of type are :node or :node_group

# 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

Private Instance Methods

attribute(attr_name) click to toggle source
# File lib/dsl/template/v1/node/semantic_parse.rb, line 43
def attribute(attr_name)
  attribute?(attr_name) || fail(Error, "Unexpected that attribute?(attr_name) is nil")
end
attribute?(attr_name) click to toggle source
# File lib/dsl/template/v1/node/semantic_parse.rb, line 47
def attribute?(attr_name)
  attributes[attr_name.to_s]
end
attributes() click to toggle source
# File lib/dsl/template/v1/node/semantic_parse.rb, line 51
def attributes
  @attributes ||= val(:Attributes) || {}
end
value_from_attribute_object(attribute) click to toggle source
# File lib/dsl/template/v1/node/semantic_parse.rb, line 55
def value_from_attribute_object(attribute)
  attribute.req(:Value)
end