Method: Bookfile::PageCtx#_locals_code

Defined in:
lib/bookfile/book/book.rb

#_locals_code(locals) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/bookfile/book/book.rb', line 72

def _locals_code( locals )
  ## convert locals hash to erb snippet with shortcuts

  ##    e.g.  country = locals[:country]

  ## and so on


  buf = "<%\n"
  locals.each do |k,v|
    puts "  add local '#{k}' #{k.class.name} - #{v.class.name}"

    buf << "#{k} = locals[:#{k}];\n"
  end
  buf << "%>\n"
  buf
end