Sha256: 6943d61bac5bfc64ed63d3b17cf57ebee05018125092c41b1448d9f09b3d8838

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 Bytes

Contents

#          Copyright (c) 2006 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

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 lib/ramaze/trinity/response.rb
ramaze-0.2.0 lib/ramaze/trinity/response.rb
ramaze-0.2.1 lib/ramaze/trinity/response.rb