Class: Tarquinn::RequestHandlerBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tarquinn/request_handler_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Redirections rules builder

Instance Method Summary collapse

Instance Method Details

#add_redirection_config(redirection, *methods, &block) ⇒ Array<Tarquinn::Condition>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a redirection rule

The rule name defines which method will be called when checking the path of redirection

Parameters:

  • redirection (Symbol)

    Rule name and method with redirection path

  • methods (Array<Symbol>)

    Methods that tell that a redirection should be applied

  • block (Proc)

    block that tells if a the redirection should be applied

Returns:



20
21
22
# File 'lib/tarquinn/request_handler_builder.rb', line 20

def add_redirection_config(redirection, *methods, &block)
  config_for(redirection).add_redirection_rules(*methods, &block)
end

#add_skip_action(redirection, *actions) ⇒ Array<Tarquinn::Condition>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Attaches a condition to skip a redirection based on route (controller action)

When any of the skip rules is met the redirection is skipped

Parameters:

  • redirection (Symbol)

    Rule name to attach the skip condition

  • actions (Array<Symbol>)

    actions / routes to be skipped by redirection rule

Returns:



32
33
34
# File 'lib/tarquinn/request_handler_builder.rb', line 32

def add_skip_action(redirection, *actions)
  config_for(redirection).add_skip_action(*actions)
end

#add_skip_config(redirection, *methods, block) ⇒ Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Attaches conditions to skip a redirection

Methods and blocks are ran and if any returns true, the redirec is skipped

Parameters:

  • redirection (Symbol)

    Rule name to attach the skip condition

  • methods (Array<Symbol>)

    Methods that tell that a redirection should be skipped

  • block (Proc)

    block that tells if a the redirection should be skipped

Returns:

  • (Array)

    Current registered conditions



44
45
46
# File 'lib/tarquinn/request_handler_builder.rb', line 44

def add_skip_config(redirection, *methods, block)
  config_for(redirection).add_skip_rules(*methods, &block)
end

#build(controller) ⇒ Tarquinn::RequestHandler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a new engine to process a request

Parameters:

  • controller (ActionController::Base)

    Controller handling the request

Returns:



53
54
55
56
# File 'lib/tarquinn/request_handler_builder.rb', line 53

def build(controller)
  controller = Tarquinn::Controller.new(controller)
  Tarquinn::RequestHandler.new(configs, controller)
end