Sha256: f7baf148551b9d1f3d2edf6549c45700da6a1ec11694786ae0c0369d79fdf591
Contents?: true
Size: 723 Bytes
Versions: 1
Compression:
Stored size: 723 Bytes
Contents
require 'rubygems' require 'sinatra/base' module Sinatra module Index def self.registered(app) app.set :static_indices, [] app.before do if app.static? && (request.get? || request.head?) orig_path = request.path_info path = unescape orig_path path = path << '/' unless path.end_with? '/' app.static_indices.each do |idx| request.path_info = path + idx static! end request.path_info = orig_path end end end def use_static_indices(*args) static_indices.concat(args.flatten) end alias_method :use_static_index, :use_static_indices end register Index end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-index-0.0.2 | lib/sinatra-index.rb |