Class: Web2Go::WebrickRequest
- Inherits:
-
Object
- Object
- Web2Go::WebrickRequest
- Defined in:
- lib/Web2Go/WebrickRequest.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#server_variable ⇒ Object
readonly
Returns the value of attribute server_variable.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean (also: #authenticated)
- #cookie(name) ⇒ Object
- #cookies ⇒ Object
- #host ⇒ Object
-
#initialize(request) ⇒ WebrickRequest
constructor
A new instance of WebrickRequest.
- #parameter(name, default_value = nil) ⇒ Object
- #path ⇒ Object
- #port ⇒ Object
- #request_method ⇒ Object
- #script_name ⇒ Object
- #uploaded_file(name, pos = 0) ⇒ Object
Constructor Details
#initialize(request) ⇒ WebrickRequest
Returns a new instance of WebrickRequest.
26 27 28 29 30 31 32 |
# File 'lib/Web2Go/WebrickRequest.rb', line 26 def initialize(request) @request = request @server_variable = request. @server_variable['SCRIPT_NAME'], @server_variable['PATH_INFO'] = split_script_and_path(clean(request.path)) find_user(request) @params = parse_parameters end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
23 24 25 |
# File 'lib/Web2Go/WebrickRequest.rb', line 23 def params @params end |
#server_variable ⇒ Object (readonly)
Returns the value of attribute server_variable.
22 23 24 |
# File 'lib/Web2Go/WebrickRequest.rb', line 22 def server_variable @server_variable end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
24 25 26 |
# File 'lib/Web2Go/WebrickRequest.rb', line 24 def user @user end |
Instance Method Details
#authenticated? ⇒ Boolean Also known as: authenticated
50 51 52 |
# File 'lib/Web2Go/WebrickRequest.rb', line 50 def authenticated? @authenticated end |
#cookie(name) ⇒ Object
74 75 76 |
# File 'lib/Web2Go/WebrickRequest.rb', line 74 def (name) return @request..find { || .name == name } end |
#cookies ⇒ Object
78 79 80 |
# File 'lib/Web2Go/WebrickRequest.rb', line 78 def @request. end |
#host ⇒ Object
42 43 44 |
# File 'lib/Web2Go/WebrickRequest.rb', line 42 def host @request.host end |
#parameter(name, default_value = nil) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/Web2Go/WebrickRequest.rb', line 56 def parameter(name,default_value=nil) value = @params[name] if value.nil? then return default_value else return value[0] end end |
#path ⇒ Object
38 39 40 |
# File 'lib/Web2Go/WebrickRequest.rb', line 38 def path @server_variable['PATH_INFO'] end |
#port ⇒ Object
46 47 48 |
# File 'lib/Web2Go/WebrickRequest.rb', line 46 def port @request.port end |
#request_method ⇒ Object
82 83 84 |
# File 'lib/Web2Go/WebrickRequest.rb', line 82 def request_method @request.request_method end |
#script_name ⇒ Object
34 35 36 |
# File 'lib/Web2Go/WebrickRequest.rb', line 34 def script_name @server_variable['SCRIPT_NAME'] end |
#uploaded_file(name, pos = 0) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/Web2Go/WebrickRequest.rb', line 65 def uploaded_file(name,pos=0) file = @request.query[name] if !file.nil? then return WebrickFile.new(file) end nil end |