Sha256: 940d28644611efa18fe13e6a4e2dd276debbf6ddbf859c3b26c3f9f7ac4f8eb1
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
# encoding: UTF-8 module Mojito::Rendering module Templates require 'tilt' require 'where' require 'mime/types' def template(*args, &block) locals = Hash === args.last ? args.pop : self.locals template = if args.size == 2 Tilt[args.first].new { args.last } elsif args.size == 1 file = Where.cdir(1) + args.first if %r{\.(?<extension>\w+)\.\w+$} =~ file.to_s response['Content-Type'] = MIME::Types.type_for(extension) end Tilt[file.to_s].new file.to_s end response.write template.render(self, locals, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mojito-0.1.1 | lib/mojito/rendering/templates.rb |