class Kitchen::BookElement
An element for an entire book
Public Class Methods
is_the_element_class_for?(node, **)
click to toggle source
Returns true if this class represents the element for the given node
@param node [Nokogiri::XML::Node] the underlying node @return [Boolean]
# File lib/kitchen/book_element.rb, line 55 def self.is_the_element_class_for?(node, **) node.name == 'body' end
new(node:, document: nil)
click to toggle source
Creates a new BookElement
@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document
Calls superclass method
# File lib/kitchen/book_element.rb, line 13 def initialize(node:, document: nil) super(node: node, document: document, enumerator_class: BookElementEnumerator) end
short_type()
click to toggle source
Returns the short type @return [Symbol]
# File lib/kitchen/book_element.rb, line 22 def self.short_type :book end
Public Instance Methods
body()
click to toggle source
Returns the “body” element
@return [Element]
# File lib/kitchen/book_element.rb, line 30 def body first!('body') end
metadata()
click to toggle source
Returns the top metadata element
@return [MetadataElement]
# File lib/kitchen/book_element.rb, line 38 def metadata metadatas.first end
toc()
click to toggle source
Returns the table of contents (toc) element
@return [Element]
# File lib/kitchen/book_element.rb, line 46 def toc first!('nav#toc') end