SixArm.com » Ruby » SignOut abstract interface for apps
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.codeclimate/badges
.yardoc
doc
lib
test
.codeclimate.yml
.document
.gemtest
.gitattributes
.gitignore
.rspec
.travis.yml
CHANGES.md
CONTRIBUTING.md
Gemfile
LICENSE.md
README.md
Rakefile
VERSION
sixarm_ruby_sign_out-1.2.0-sha512.txt
sixarm_ruby_sign_out-1.2.0.gem
sixarm_ruby_sign_out.gemspec

README.md

SixArm.com → Ruby →
SignOut abstract interface for apps

Gem Version Build Status Code Climate Maintainability Coverage Status

Introduction

SignOut is a simple abstract interface for apps.

You can include this module in a Rails application controller, then your controller can define any of these concrete methods.

For docs go to http://sixarm.com/sixarm_ruby_sign_out/doc

Want to help? We're happy to get pull requests.

Install

Gem

Run this command in your shell or terminal:

gem install sixarm_ruby_sign_out

Or add this to your Gemfile:

gem 'sixarm_ruby_sign_out'

Require

To require the gem in your code:

require 'sixarm_ruby_sign_out'

Details

This provides one top-level method:

sign_out(options=nil) => true for success, false for failure

The top level method will call mid-level methods that you will define in your own controller.

sign_out calls:

sign_out_attempt(options=nil), e.g. unset the current user
sign_out_success(options=nil), e.g. redirect to a goodbye page
sign_out_failure(options=nil), e.g. flash warning help message

AuthLogic Example

AuthLogic provides this example:

def destroy
  current_user_session.destroy
 redirect_to new_user_session_url
end

The same example written using Sign Out to provide better structure and security:

def sign_out_attempt
  current_user_session.destroy
  current_user_session.frozen? or raise SecurityError, "Problem with sign out ... ", caller
end

def sign_out_success
  redirect_to new_user_session_url
end

def sign_out_failure
  # The AuthLogic example doesn't handle this case unfortunately;
  # we should handle it because it indicates something is amiss.
end