Sha256: 872f0993d70d802dd857bca2bb145b3aeb11228b01ba2fe701c1634680e0394c

Contents?: true

Size: 374 Bytes

Versions: 5

Compression:

Stored size: 374 Bytes

Contents

# frozen_string_literal: true

export :load

def run(app)
  ->(req) {
    response = app.(env(req))
    respond(req, response)
  }
end

def load(path)
  src = IO.read(path)
  instance_eval(src)
end

def env(request)
  { }
end

def respond(request, (status_code, headers, body))
  headers[':status'] = status_code.to_s
  body = body.first
  request.respond(body, headers)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polyphony-0.19 lib/polyphony/http/rack.rb
polyphony-0.17 lib/polyphony/http/rack.rb
polyphony-0.16 lib/polyphony/http/rack.rb
polyphony-0.15 lib/polyphony/http/rack.rb
polyphony-0.14 lib/polyphony/http/rack.rb