Sha256: 9b8e98962fcbd5a3ef1d77c1b2fd34067256ad63baf6966d64e0550e9548ef65

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'cgi'
require 'cgi/session'
require 'cgi/session/pstore'
require 'action_controller/cgi_ext/cgi_methods'

# Wrapper around the CGIMethods that have been secluded to allow testing without 
# an instatiated CGI object
class CGI #:nodoc:
  class << self
    alias :escapeHTML_fail_on_nil :escapeHTML

    def escapeHTML(string)
      escapeHTML_fail_on_nil(string) unless string.nil?
    end
  end
  
  # Returns a parameter hash including values from both the request (POST/GET)
  # and the query string with the latter taking precedence.
  def parameters
    request_parameters.update(query_parameters)
  end

  def query_parameters
    CGIMethods.parse_query_parameters(query_string)
  end

  def request_parameters
    CGIMethods.parse_request_parameters(params)
  end

  def redirect(where)
     header({ 
       "Status" => "302 Moved", 
       "location" => "#{where}"
    })
  end
  
  def session(parameters = nil)
    parameters = {} if parameters.nil?
    parameters['database_manager'] = CGI::Session::PStore
    CGI::Session.new(self, parameters)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/actionpack-1.4.0/lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-0.9.5 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-0.9.0 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.0.0 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.0.1 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.1.0 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.2.0 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.3.0 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.3.1 lib/action_controller/cgi_ext/cgi_ext.rb
actionpack-1.4.0 lib/action_controller/cgi_ext/cgi_ext.rb