Class | Ramaze::Helper::User::Wrapper
In: | lib/ramaze/helper/user.rb
Parent: | BlankSlate

Wrapper for the ever-present "user" in your application. It wraps around an arbitrary instance and worries about authentication and storing information about the user in the session.

In order to not interfere with the wrapped instance/model we start our methods with an underscore.

Patches and suggestions are highly appreciated.

### Methods

_logged_in? _login _logout _persistence _persistence= _would_login? method_missing new

### Attributes

_callback | [RW] |
_model | [RW] |
_user | [RW] |

### Public Class methods

new(model, callback)

### Public Instance methods

_logged_in?()

@return [true false] whether the current user is logged in. @api internal @see Ramaze::Helper::User#logged_in? @author manveru

_login(creds = _persistence)

@param [Hash] creds this hash will be stored in the session on successful login @return [Ramaze::Helper::User::Wrapper] wrapped return value from

                                            model or callback

@see Ramaze::Helper::User#user_login @author manveru

_logout()

@api internal @see Ramaze::Helper::User#user_logout @author manveru

_persistence()
_persistence=(creds)
_would_login?(creds)

The callback should return an instance of the user, otherwise it should answer with nil.

This will not actually login, just check whether the credentials would result in a user.

method_missing(meth, *args, &block)

Refer everything not known THINK: This might be quite confusing… should we raise instead?

[Validate]