class Kitchen::CompositeChapterElement

An element for a composite chapter

Public Class Methods

new(node:, document: nil) click to toggle source

Creates a new CompositeChapterElement

@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document

Calls superclass method
# File lib/kitchen/composite_chapter_element.rb, line 13
def initialize(node:, document: nil)
  super(node: node,
        document: document,
        enumerator_class: ElementEnumerator)
end
short_type() click to toggle source

Returns short type

# File lib/kitchen/composite_chapter_element.rb, line 21
def self.short_type
  :composite_chapter
end

Public Instance Methods

title() click to toggle source

Returns the title element (the one in the immediate children, not the one in the metadata)

@raise [ElementNotFoundError] if no matching element is found @return [Element]

# File lib/kitchen/composite_chapter_element.rb, line 30
def title
  # Get the title in the immediate children, not the one in the metadata.  Could use
  # CSS of ":not([data-type='metadata']) > [data-type='document-title'], [data-type='document-title']"
  # but xpath is shorter
  first!("./*[@data-type = 'document-title']")
end