Tarquinn

Build Status Code Climate Test Coverage Issue Count Gem Version Inline docs

tarquinn

Yard Documentation

https://www.rubydoc.info/gems/tarquinn/0.2.0

This gem makes easier to controll generic redirection

Getting started

  1. Add Tarquinn to your Gemfile and bundle install:
    gem 'tarquinn'
  1. Include Tarquinn to your controller or to your base controller

    ApplicationController < ActionController::Base
      include Tarquinn
    end
    
  2. Program your redirection on your controllers

    BaseController < ApplicationController
      redirection_rule :redirect_login, :loggin_needed?
    
      private
    
      def redirect_login
        login_path
      end
    
      def loggin_needed?
        user.nil?
      end
    end
    
    StaticController < BaseController
      skip_redirection_rule :redirect_login, :is_home?
    
      private
    
      def is_home?
        params[:action] == 'home'
      end
    end