Sha256: b22cf51af07b54bb203fd469d057f8efa3942470ab3ad2c3537c216b048ee2fe

Contents?: true

Size: 580 Bytes

Versions: 12

Compression:

Stored size: 580 Bytes

Contents

module Innate
  class Response < Rack::Response
    include Optioned

    options.dsl do
      o "Default headers, will not override headers already set",
        :headers, {'Content-Type' => 'text/html'}
    end

    def self.mime_type
      options[:headers]['Content-Type'] || 'text/html'
    end

    def reset
      self.status = 200
      self.header.delete('Content-Type')
      body.clear
      self.length = 0
      self
    end

    def finish
      options.headers.each{|key, value| self[key] ||= value }
      Current.session.flush(self)
      super
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
innate-2015.10.28 lib/innate/response.rb
innate-2013.02.21 lib/innate/response.rb
innate-2013.02 lib/innate/response.rb
innate-2012.12 lib/innate/response.rb
innate-2012.03 lib/innate/response.rb
innate-2011.12 lib/innate/response.rb
innate-2011.10 lib/innate/response.rb
innate-2011.04 lib/innate/response.rb
innate-2011.01 lib/innate/response.rb
innate-2010.07 lib/innate/response.rb
innate-2010.06.18 lib/innate/response.rb
innate-2010.04 lib/innate/response.rb