Class: Kitchen::BookRecipe

Inherits:
Recipe show all
Defined in:
lib/kitchen/book_recipe.rb

Overview

A specialized Recipe that yields a BookDocument instead of a plain Document

Instance Attribute Summary collapse

Attributes inherited from Recipe

#document, #my_i18n_backend, #source_location

Instance Method Summary collapse

Methods inherited from Recipe

#bake

Constructor Details

#initialize(book_short_name: :not_set) {|doc| ... } ⇒ BookRecipe

Make a new BookRecipe

Parameters:

  • book_short_name (Symbol, String) (defaults to: :not_set)

    the book’s short name

Yield Parameters:

  • doc (BookDocument)

    an object representing an XML document



20
21
22
23
# File 'lib/kitchen/book_recipe.rb', line 20

def initialize(book_short_name: :not_set, &block)
  @book_short_name = book_short_name.to_sym
  super(&block)
end

Instance Attribute Details

#book_short_nameSymbol (readonly)

The book’s short name

Returns:

  • (Symbol)


13
14
15
# File 'lib/kitchen/book_recipe.rb', line 13

def book_short_name
  @book_short_name
end

Instance Method Details

#document=(document) ⇒ Object

Overrides document= to ensure a BookDocument is stored

Parameters:



29
30
31
32
33
34
35
36
# File 'lib/kitchen/book_recipe.rb', line 29

def document=(document)
  super(document)
  @document = Kitchen::BookDocument.new(
    document: @document,
    short_name: book_short_name,
    config: @document.config.clone
  )
end