Sha256: 74b85a07ab45ae3ce720b3d03afed26dab05718a81785986909349b00017f985
Contents?: true
Size: 703 Bytes
Versions: 1
Compression:
Stored size: 703 Bytes
Contents
# encoding: utf-8 Rango.import("mixins/controller") # run app { |request, response| # if request.env["PATH_INFO"].match(/^\/admin/) # redirect "" # else # render "index" # end # } module Rango module Mini include Rango::ControllerMixin def app(&block) lambda do |env| request = Rango::Request.new(env) response = Rack::Response.new body = block.call(request, response) # TODO: check how rack test if object is stringable, probably not this way raise ArgumentError unless body.respond_to?(:each) || body.is_a?(String) response.write(body) response.finish end end end end Rack::Builder.send(:include, Rango::Mini)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rango-0.0.4 | lib/rango/mixins/mini.rb |