Sha256: b32cd5db090ee4d8bac15768e5b1ac66724c62399c56df3f476f51a24071f2ad
Contents?: true
Size: 758 Bytes
Versions: 2
Compression:
Stored size: 758 Bytes
Contents
# encoding: utf-8 require "rango/gv" module Rango module GV def self.static(template, locals = nil, &hook) Rango::Mini.app do |request, response| path = template || request.env["rango.router.params"][:template] path = hook.call(path) unless hook.nil? path = "#{path}.html" unless path.match(/\./) Rango.logger.debug("Rendering '#{path}'") # Rango::RenderMixin.context locals = locals.call(request) if locals.respond_to?(:call) # lambda { |request| {msg: request.message} } render path, locals end end # you would usually define module Static with instance method static for # including into controllers, but since controllers have render, it would be useless end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rango-0.1.1.1 | lib/rango/gv/static.rb |
rango-0.1.1 | lib/rango/gv/static.rb |