Class: Duxml::NullChildPatternClass

Inherits:
PatternClass show all
Includes:
ChildPattern
Defined in:
lib/duxml/meta/grammar/pattern/child_pattern.rb

Overview

null child patterns represent and parent child relationship where the child is required by the Grammar but the element is missing that child

Instance Attribute Summary collapse

Attributes inherited from PatternClass

#subject

Attributes included from Duxml

#doc

Attributes included from Saxer

#io

Instance Method Summary collapse

Methods included from Pattern

#<=>, #abstract?, #concrete?, #name, #object, #simple_name, #xml

Methods included from Duxml

#load, #log, #save, #validate

Methods included from Saxer

#sax

Constructor Details

#initialize(_subject, _missing_child, _index = -1)) ⇒ NullChildPatternClass

Returns a new instance of NullChildPatternClass.

Parameters:

  • _subject (Element)

    parent element

  • _missing_child (String)

    nmtoken for missing child element



30
31
32
33
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 30

def initialize(_subject, _missing_child, _index=-1)
  @missing_child, @index = _missing_child, _index
  super _subject
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



44
45
46
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 44

def index
  @index
end

#missing_childObject (readonly) Also known as: child

Returns the value of attribute missing_child.



44
45
46
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 44

def missing_child
  @missing_child
end

Instance Method Details

#descriptionString

Returns description of this child pattern.

Returns:

  • (String)

    description of this child pattern



40
41
42
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 40

def description
  "#{subject.description} #{relationship} <#{child}>"
end

#relationshipObject



35
36
37
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 35

def relationship
  'missing child'
end