Class: Fragmentary::SessionUser
- Inherits:
-
Object
- Object
- Fragmentary::SessionUser
- Defined in:
- lib/fragmentary/session_user.rb
Instance Attribute Summary collapse
-
#user_type ⇒ Object
readonly
Returns the value of attribute user_type.
Class Method Summary collapse
Instance Method Summary collapse
- #credentials ⇒ Object
-
#initialize(user_type, options = {}) ⇒ SessionUser
constructor
A new instance of SessionUser.
Constructor Details
#initialize(user_type, options = {}) ⇒ SessionUser
Returns a new instance of SessionUser.
30 31 32 33 |
# File 'lib/fragmentary/session_user.rb', line 30 def initialize(user_type, ={}) @user_type = user_type # this probably not really necessary @options = end |
Instance Attribute Details
#user_type ⇒ Object (readonly)
Returns the value of attribute user_type.
5 6 7 |
# File 'lib/fragmentary/session_user.rb', line 5 def user_type @user_type end |
Class Method Details
.create(user_type, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fragmentary/session_user.rb', line 17 def self.create(user_type, ={}) user_group = [:group] || [:user_group] || 'default' if user = fetch(user_type, user_group) raise RangeError, "You can't redefine an existing SessionUser object: #{user_type.inspect}" unless user. == else @user_type = user_type # this probably not really necessary @options = user = new(user_type, ) all[user_type].merge!(user_group => user) end user end |
.fetch(user_type, user_group = 'default') ⇒ Object
13 14 15 |
# File 'lib/fragmentary/session_user.rb', line 13 def self.fetch(user_type, user_group = 'default') all[user_type][user_group] end |
Instance Method Details
#credentials ⇒ Object
35 36 37 |
# File 'lib/fragmentary/session_user.rb', line 35 def credentials [:credentials] end |