Class: Kitchen::BookDocument
- Defined in:
- lib/kitchen/book_document.rb
Overview
A specialized form of Document
for our books.
Instance Attribute Summary collapse
-
#short_name ⇒ Symbol
readonly
This book’s short name, used to look up translations, etc.
Attributes inherited from Document
#config, #id_tracker, #location
Instance Method Summary collapse
-
#book ⇒ BookElement
Returns the top-level
BookElement
for this document. -
#initialize(document:, short_name: :not_set, config: nil) ⇒ BookDocument
constructor
Creates a new BookDocument.
Methods inherited from Document
#clipboard, #counter, #create_element, #create_element_from_string, #encoding, #locale, #pantry, #raw, #search, #selectors, #to_html, #to_s, #to_xhtml, #to_xml
Constructor Details
#initialize(document:, short_name: :not_set, config: nil) ⇒ BookDocument
Creates a new BookDocument
20 21 22 23 24 25 |
# 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 |
Instance Attribute Details
#short_name ⇒ Symbol (readonly)
This book’s short name, used to look up translations, etc.
11 12 13 |
# File 'lib/kitchen/book_document.rb', line 11 def short_name @short_name end |
Instance Method Details
#book ⇒ BookElement
Returns the top-level BookElement
for this document
31 32 33 |
# File 'lib/kitchen/book_document.rb', line 31 def book BookElement.new(node: nokogiri_document.root, document: self) end |