Class: Tarquinn::RedirectionHandler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tarquinn/redirection_handler.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.

Redirect config handler

Checks if one redirection rule should or should not be applied

Instance Method Summary collapse

Constructor Details

#initialize(config, controller) ⇒ RedirectionHandler

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.

Returns a new instance of RedirectionHandler.

Parameters:



12
13
14
15
# File 'lib/tarquinn/redirection_handler.rb', line 12

def initialize(config, controller)
  @config = config
  @controller = controller
end

Instance Method Details

#perform_redirect?TrueClass, FalseClass

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.

Checks if redirection should be performd

Returns:

  • (TrueClass)

    when redirection should be performed

  • (FalseClass)

    when redirection should not be performed



21
22
23
24
25
# File 'lib/tarquinn/redirection_handler.rb', line 21

def perform_redirect?
  return perform_redirect if instance_variable_defined?(:@perform_redirect)

  @perform_redirect = redirect?
end

#redirectString

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.

Performs redirction to a new route

Returns:

  • (String)

    redirection body



30
31
32
# File 'lib/tarquinn/redirection_handler.rb', line 30

def redirect
  controller.call(:redirect_to, redirect_path)
end