File: response.rb

package info (click to toggle)
hiki 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,812 kB
  • ctags: 2,033
  • sloc: ruby: 14,572; lisp: 926; sh: 19; makefile: 16
file content (22 lines) | stat: -rw-r--r-- 434 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22


module Hiki
  if Object.const_defined?(:Rack)
    Response = ::Rack::Response
  else
    class Response
      attr_reader :body, :status, :headers
      def initialize(body = [], status = 200, headers = {}, &block)
        @cgi = CGI.new
        @body = body
        @status = status
        @headers = headers
        yield self if block_given?
      end

      def header
        @cgi.header(@headers)
      end
    end
  end
end