Sha256: 1482e697b3c41230d7bf6dcec1c32f9c71018ada8089dfffe794384499072dc8
Contents?: true
Size: 865 Bytes
Versions: 11
Compression:
Stored size: 865 Bytes
Contents
module Rack module Blogengine class ApplicationRouter # Maps documents to routes. # @param env Env Contains path info etc... # @param target Target folder # @return [Hash] route Hash {:path => "/foo", :response => [Array]} def self.map_route(env, target) status = 200 header = {"Content-Type" => "text/html; charset=UTF-8"} path = env["PATH_INFO"] documents = DocParser.parseInDocuments(target) # Iterate through available docs, if nothing matched return nil documents.each do |doc| if doc[:path] == path route_response = { "route" => path, "response" => [status, header, [doc[:html]] ] } return route_response end end return nil end end end end
Version data entries
11 entries across 11 versions & 1 rubygems