Class: WebSystem::SimpleRequest
- Inherits:
-
Request
show all
- Defined in:
- lib/web_system/sub/request/requests/simple_request.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
color, inherited, on_connected
Methods inherited from Liza::Unit
const_missing, division, part, system, #system, test_class
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
11
12
13
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 11
def env
@env
end
|
Class Method Details
.call(env) ⇒ Object
5
6
7
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 5
def self.call env
new.call env
end
|
Instance Method Details
#_call_action ⇒ Object
27
28
29
30
31
32
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 27
def _call_action
return public_send "call_#{action}!" if http_method == "POST" and respond_to? "call_#{action}!"
return public_send "call_#{action}" if respond_to? "call_#{action}"
response_404
end
|
#action ⇒ Object
49
50
51
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 49
def action
@action ||= env["LIZA_ACTION"].to_sym
end
|
#call(env) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 13
def call env
@env = env
@status = 200
@headers = {
"Framework" => "Liza #{Lizarb::VERSION}"
}
_call_action
@body ||= render format, action, format: format
[@status, @headers, [@body]]
end
|
53
54
55
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 53
def format
@format ||= env["LIZA_FORMAT"].to_sym
end
|
#http_method ⇒ Object
41
42
43
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 41
def http_method
env["REQUEST_METHOD"]
end
|
#qs ⇒ Object
61
62
63
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 61
def qs
@qs ||= (env["QUERY_STRING"] || "").split("&").map { _1.split("=") }.to_h
end
|
#request ⇒ Object
45
46
47
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 45
def request
@request ||= env["LIZA_REQUEST"].to_sym
end
|
#response_404 ⇒ Object
34
35
36
37
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 34
def response_404
@status = 404
@body = "404"
end
|
#segments ⇒ Object
57
58
59
|
# File 'lib/web_system/sub/request/requests/simple_request.rb', line 57
def segments
@segments ||= env["LIZA_SEGMENTS"]
end
|