1 # -*- encoding: binary -*-
6 autoload :InputWrapper, 'metropolis/input_wrapper'
7 autoload :Deflate, 'metropolis/deflate'
8 autoload :Gzip, 'metropolis/gzip'
9 autoload :TC, 'metropolis/tc'
10 autoload :Hash, 'metropolis/hash'
11 autoload :TDB, 'metropolis/tdb'
13 def self.new(opts = {})
16 uri = opts[:uri] = URI.parse(opts[:uri])
19 opts[:path] = uri.path if uri.path != '/'
20 rv.extend Metropolis::Hash
22 opts[:path_pattern] = uri.path
23 opts[:query] = Rack::Utils.parse_query(uri.query) if uri.query
24 rv.extend Metropolis::TDB
26 opts[:path_pattern] = uri.path
27 opts[:query] = Rack::Utils.parse_query(uri.query) if uri.query
28 case ext = File.extname(uri.path)
30 rv.extend Metropolis::TC::HDB
32 raise ArgumentError, "unsupported suffix: #{ext}"
35 raise ArgumentError, "unsupported URI scheme: #{uri.scheme}"
42 require 'metropolis/common'