Class: Bookfile::BookDef

Inherits:
Object
  • Object
show all
Defined in:
lib/bookfile/book/book.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}, proc) ⇒ BookDef

Returns a new instance of BookDef.



88
89
90
91
92
# File 'lib/bookfile/book/book.rb', line 88

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



94
95
96
97
98
# File 'lib/bookfile/book/book.rb', line 94

def build( unzip_dir )
  config = BookConfig.new( templates_dir: "#{unzip_dir}/_templates" )
  ctx = BookCtx.new( config )
  @proc.call( ctx )  ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not??
end