Class: Jetski::Router::Host::Crud

Inherits:
Base
  • Object
show all
Defined in:
lib/jetski/router/host/crud.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#action_name, #all_server_options, #controller_class, #controller_classname, #controller_file_name, #controller_name, #controller_path, #errors, #req, #request_method, #res, #served_url, #server

Instance Method Summary collapse

Constructor Details

#initialize(server, controller_routes, **server_options) ⇒ Crud

Returns a new instance of Crud.



8
9
10
11
12
# File 'lib/jetski/router/host/crud.rb', line 8

def initialize(server, controller_routes, **server_options)
  server_options[:url] = server_options[:controller_path]
  super(server, **server_options)
  @handle_controller_render = true
end

Instance Attribute Details

#custom_route_optionsObject (readonly)

Responsible for hosting auto crud routes



6
7
8
# File 'lib/jetski/router/host/crud.rb', line 6

def custom_route_options
  @custom_route_options
end

#handle_controller_renderObject

Returns the value of attribute handle_controller_render.



7
8
9
# File 'lib/jetski/router/host/crud.rb', line 7

def handle_controller_render
  @handle_controller_render
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jetski/router/host/crud.rb', line 14

def call
  super do
    @custom_route_options = all_server_options.dup.except(:action_name, :method)
    determine_action_from_url
    if handle_controller_render
      @controller_host = Jetski::Router::Host::Controller.new(server, **custom_route_options)
      @controller_host.res = res
      @controller_host.req = req
      @controller_host.fetch_controller_class
      @controller_host.call_controller
    end
  end
end