Module: Tarquinn::ClassMethods
- Defined in:
- lib/tarquinn/class_methods.rb
Overview
Methods added by Tarquinn
Instance Method Summary collapse
-
#redirection_rule(redirection, *methods) ⇒ Array<Tarquinn::Condition>
Creates a redirection rule.
-
#redirector_builder ⇒ RequestHandlerBuilder
Retruns the RequestHandlerBuilder.
-
#skip_redirection(redirection, *actions) ⇒ Array<Tarquinn::Condition>
Attaches a condition to skip a redirection based on route (controller action).
-
#skip_redirection_rule(redirection, *methods, &block) ⇒ Array
Attaches conditions to skip a redirection.
Instance Method Details
#redirection_rule(redirection, *methods) ⇒ Array<Tarquinn::Condition>
Creates a redirection rule
The rule name defines which method will be called when checking the path of redirection
14 15 16 |
# File 'lib/tarquinn/class_methods.rb', line 14 def redirection_rule(redirection, *methods, &) redirector_builder.add_redirection_config(redirection, *methods, &) end |
#redirector_builder ⇒ RequestHandlerBuilder
Retruns the RequestHandlerBuilder
RequestHandlerBuilder will Carry all the configurations and will create one RequestHandler for each request
44 45 46 |
# File 'lib/tarquinn/class_methods.rb', line 44 def redirector_builder @redirector_builder ||= Tarquinn::RequestHandlerBuilder.new end |
#skip_redirection(redirection, *actions) ⇒ Array<Tarquinn::Condition>
Attaches a condition to skip a redirection based on route (controller action)
When any of the skip rules is met the redirection is skipped
24 25 26 |
# File 'lib/tarquinn/class_methods.rb', line 24 def skip_redirection(redirection, *actions) redirector_builder.add_skip_action(redirection, *actions) end |
#skip_redirection_rule(redirection, *methods, &block) ⇒ Array
Attaches conditions to skip a redirection
Methods and blocks are ran and if any returns true, the redirec is skipped
34 35 36 |
# File 'lib/tarquinn/class_methods.rb', line 34 def skip_redirection_rule(redirection, *methods, &block) redirector_builder.add_skip_config(redirection, *methods, block) end |