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

Constant Summary

Constants included from Duxml

DITA_GRAMMAR

Constants included from Meta

Meta::FILE_EXT

Instance Attribute Summary collapse

Attributes inherited from PatternClass

#subject

Attributes included from Duxml

#doc, #file, #meta

Attributes included from Saxer

#io

Instance Method Summary collapse

Methods included from Pattern

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

Methods included from Duxml

#create, #load, #log, #relaxng, #save, #validate

Methods included from Meta

#grammar=, meta_path, xml

Methods included from Saxer

#sax

Constructor Details

#initialize(_subject, _missing_child) ⇒ 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)
  @missing_child = _missing_child
  super _subject
end

Instance Attribute Details

#missing_childObject (readonly) Also known as: child

Returns the value of attribute missing_child.



49
50
51
# File 'lib/duxml/meta/grammar/pattern/child_pattern.rb', line 49

def missing_child
  @missing_child
end

Instance Method Details

#descriptionString

Returns description of this child pattern.

Returns:

  • (String)

    description of this child pattern



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

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

#index-1

Returns class must respond to #index; only NullChildPatternClass is allowed to have a negative index.

Returns:

  • (-1)

    class must respond to #index; only NullChildPatternClass is allowed to have a negative index



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

def index
  -1
end

#relationshipObject



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

def relationship
  'missing child'
end