class Bookfile::BookCtx
Public Class Methods
new( config, book_opts={} )
click to toggle source
# File lib/bookfile/book/book.rb, line 88 def initialize( config, book_opts={} ) @config = config ## todo: add opts to config ??? ## e.g. title, layout, inline ??? - why? why not?? @builder = BookBuilder.new( config.pages_dir, book_opts ) end
Public Instance Methods
page( name, page_opts={} ) { |ctx| ... }
click to toggle source
change name to path - why, why not??
# File lib/bookfile/book/book.rb, line 96 def page( name, page_opts={} ) ## &block puts "[BookCtx#page] #{name} opts:#{page_opts.inspect}" puts "[BookCtx#page] before yield" ctx = PageCtx.new( @config ) ## pass along self (bookctx) as parent yield( ctx ) ## same as - ctx.instance_eval( &block ) puts "[BookCtx#page] after yield" @builder.page( name, page_opts ) do |page| page.write ctx.content end end