metropolis.git  about / heads / tags
key-value store for Rack
blob c6015df2667692e63b4eae7ade472d8baaa4fc9a 367 bytes (raw)
$ git show HEAD:lib/metropolis/common/ro.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 
# -*- encoding: binary -*-
module Metropolis::Common::RO
  include Metropolis::Constants

  def call(env)
    if %r{\A/(.*)\z} =~ env[PATH_INFO]
      key = unescape($1)
      case env[REQUEST_METHOD]
      when "GET"
        get(key, env)
      when "HEAD"
        head(key, env)
      else
        r(403)
      end
    else # OPTIONS
      r(405)
    end
  end
end

git clone https://yhbt.net/metropolis.git