Top Level Namespace
Defined Under Namespace
Classes: Datagnan
Instance Method Summary collapse
-
#datagnan(template_file, options = {}, locals = {}) ⇒ Object
Helper function (for Sinatra, primarily).
-
#oga ⇒ Object
Oga for HTML parsing (Yeah, no Nokogiri!).
Instance Method Details
#datagnan(template_file, options = {}, locals = {}) ⇒ Object
Helper function (for Sinatra, primarily)
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/datagnan.rb', line 314 def datagnan(template_file, = {}, locals = {}) # beginning_time = Time.now ## default options scope = .delete(:scope) || self views = File.realpath(.delete(:views) || scope.settings.views || "./views") locals = .delete(:locals) || locals || {} html = Datagnan.read(File.join(views, template_file.to_s+'.html'), :scope => scope, :locals => locals) ## debug # puts "-- datagnan ( template = #{html} )" if File.exist? File.join(views, 'layout.html') locals['template'] = {'html' => html} html = Datagnan.read(File.join(views, 'layout.html'), :scope => scope, :locals => locals) ## debug # puts "-- datagnan ( layout = #{html} )" end # end_time = Time.now # puts "Time elapsed for datagnan #{(end_time - beginning_time)*1000} milliseconds" return html end |
#oga ⇒ Object
Oga for HTML parsing (Yeah, no Nokogiri!)
2 |
# File 'lib/datagnan.rb', line 2 require 'oga' |