Class: CGI

Inherits:
Object
  • Object
show all
Defined in:
lib/sbsm/cgi.rb

Class Method Summary collapse

Class Method Details

.initialize_without_offline_prompt(*args) ⇒ Object

Lets satisfy cgi-offline prompt, even if request does not have REQUEST_METHOD. (It must be mostly for test purpose). See ruby-doc.org/stdlib-2.3.1/libdoc/cgi/rdoc/CGI.html#method-c-new



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sbsm/cgi.rb', line 33

def self.initialize_without_offline_prompt(*args)
  cgi_input = true
  unless ENV.has_key?('REQUEST_METHOD')
    cgi_input = false
    ENV['REQUEST_METHOD'] = 'GET'
  end
  cgi = CGI.new(*args)
  unless cgi_input
    ENV.delete('REQUEST_METHOD')
  end
  cgi
end