Sha256: 17c9bd22c8ef64239760bf2789b64fb709d1ca3be47d2e72911ccf73a39bd8b3

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze

  # Subclassing Rack::Response for our own purposes.
  class Response < ::Rack::Response
    # build a response, default values are from the current response.

    def build body = body, status = status, head = header
      Dispatcher.set_cookie if Global.sessions

      head.each do |key, value|
        self[key] = value
      end

      self.body, self.status = body, status
      self
    end

    class << self

      # get the current response out of Thread.current[:response]
      #
      # You can call this from everywhere with Ramaze::Response.current

      def current
        Thread.current[:response]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.3.0 lib/ramaze/trinity/response.rb
ramaze-0.3.5 lib/ramaze/trinity/response.rb