class Kitchen::CompositePageElement
An element for a composite page
Public Class Methods
new(node:, document: nil)
click to toggle source
Creates a new CompositePageElement
@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document
Calls superclass method
# File lib/kitchen/composite_page_element.rb, line 13 def initialize(node:, document: nil) super(node: node, document: document, enumerator_class: CompositePageElementEnumerator) end
short_type()
click to toggle source
Returns the short type @return [Symbol]
# File lib/kitchen/composite_page_element.rb, line 22 def self.short_type :composite_page end
Public Instance Methods
is_citation_reference?()
click to toggle source
Returns true if this page is a book citation reference
@return [Boolean]
# File lib/kitchen/composite_page_element.rb, line 65 def is_citation_reference? has_class?('os-eob os-reference-container') end
is_index?()
click to toggle source
Returns true if this page is a book index
@return [Boolean]
# File lib/kitchen/composite_page_element.rb, line 40 def is_index? has_class?('os-index-container') end
is_index_of_type?()
click to toggle source
Returns true if this page is a book index of type
@return [Boolean]
# File lib/kitchen/composite_page_element.rb, line 48 def is_index_of_type? (self[:class] || '').match?(/os-index-.+-container/) end
is_section_reference?()
click to toggle source
Returns true if this page is a book section reference
@return [Boolean]
# File lib/kitchen/composite_page_element.rb, line 73 def is_section_reference? has_class?('os-eob os-references-container') end
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_page_element.rb, line 31 def title first!('h3[data-type="title"], h2[data-type="document-title"],' \ 'h1[data-type="document-title"]') end