class Kitchen::BookDocument
A specialized form of Document
for our books.
Attributes
short_name[R]
This book's short name, used to look up translations, etc. @return [Symbol] the name
Public Class Methods
new(document:, short_name: :not_set, config: nil)
click to toggle source
Creates a new BookDocument
@param document [Document, Nokogiri::XML::Document] the underlying document;
if a +Document+ it is converted to a +Nokogiri::XML::Document+
@param short_name
[Symbol, String] the book's short name @param config [Config] the book's configuration
Calls superclass method
# File lib/kitchen/book_document.rb, line 20 def initialize(document:, short_name: :not_set, config: nil) @short_name = short_name.to_sym super(nokogiri_document: document.is_a?(Document) ? document.raw : document, config: config) end
Public Instance Methods
book()
click to toggle source
Returns the top-level BookElement
for this document
@return [BookElement]
# File lib/kitchen/book_document.rb, line 31 def book BookElement.new(node: nokogiri_document.root, document: self) end