Class: Bookfile::BookDef
- Inherits:
-
Object
- Object
- Bookfile::BookDef
- Defined in:
- lib/bookfile/book/book.rb
Instance Method Summary collapse
- #build(unzip_dir) ⇒ Object
-
#initialize(opts = {}, proc) ⇒ BookDef
constructor
A new instance of BookDef.
Constructor Details
#initialize(opts = {}, proc) ⇒ BookDef
Returns a new instance of BookDef.
113 114 115 116 117 |
# File 'lib/bookfile/book/book.rb', line 113 def initialize( opts={}, proc ) @opts = opts @proc = proc ## use name block (why,why not??) ## @block = block ## save block as proc ?? ?? end |
Instance Method Details
#build(unzip_dir) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/bookfile/book/book.rb', line 119 def build( unzip_dir ) defaults = { templates_dir: "#{unzip_dir}/_templates", pages_dir: "#{unzip_dir}/_pages" } ## note: ## (auto)build two versions: ## 1) multi-page version - for (easy) browsing ## 2) all-in-one-page version - for (easy)pdf conversion multi_page_ctx = BookCtx.new( BookConfig.new( defaults )) @proc.call( multi_page_ctx ) ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not?? one_page_ctx = BookCtx.new( BookConfig.new( defaults ), inline: true ) @proc.call( one_page_ctx ) ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not?? end |