Class: WebSystem::SimpleRouterRequest

Inherits:
RouterRequest show all
Defined in:
lib/web_system/sub/request/router_requests/simple_router_request.rb

Defined Under Namespace

Classes: RequestNotFound

Class Method Summary collapse

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

._find_request_class(request) ⇒ Object



18
19
20
21
22
# File 'lib/web_system/sub/request/router_requests/simple_router_request.rb', line 18

def self._find_request_class request
  Liza.const "#{request}_request"
rescue Liza::ConstNotFound
  raise RequestNotFound
end

.call(env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/web_system/sub/request/router_requests/simple_router_request.rb', line 4

def self.call(env)
  segments = env["LIZA_SEGMENTS"].dup
  request = segments.shift || "root"
  action  = segments.shift || "index"

  env["LIZA_REQUEST"] = request
  env["LIZA_ACTION"] = action
  format = env["LIZA_FORMAT"]

  log({request:, action:, format:})
  
  env["LIZA_REQUEST_CLASS"] = _find_request_class request
end