Module: Isomorfeus
- Defined in:
- lib/isomorfeus/empowerment/config.rb,
lib/isomorfeus/empowerment/session.rb,
lib/isomorfeus/empowerment/version.rb,
lib/isomorfeus/empowerment/session_task.rb,
lib/isomorfeus/empowerment/session_cleanup.rb
Defined Under Namespace
Modules: Empowerment
Instance Attribute Summary collapse
-
#session_class ⇒ Object
readonly
Returns the value of attribute session_class.
Instance Method Summary collapse
- #add_valid_user_class(klass) ⇒ Object
- #cached_user_class(class_name) ⇒ Object
- #cached_user_classes ⇒ Object
- #current_user ⇒ Object
- #init_current_user ⇒ Object
- #set_current_user(user) ⇒ Object
- #valid_user_class_name?(class_name) ⇒ Boolean
- #valid_user_class_names ⇒ Object
Instance Attribute Details
#session_class ⇒ Object (readonly)
Returns the value of attribute session_class.
27 28 29 |
# File 'lib/isomorfeus/empowerment/config.rb', line 27 def session_class @session_class end |
Instance Method Details
#add_valid_user_class(klass) ⇒ Object
37 38 39 |
# File 'lib/isomorfeus/empowerment/config.rb', line 37 def add_valid_user_class(klass) valid_user_class_names << raw_class_name(klass) end |
#cached_user_class(class_name) ⇒ Object
45 46 47 48 49 |
# File 'lib/isomorfeus/empowerment/config.rb', line 45 def cached_user_class(class_name) return "::#{class_name}".constantize if Isomorfeus.development? return cached_user_classes[class_name] if cached_user_classes.key?(class_name) cached_user_classes[class_name] = "::#{class_name}".constantize end |
#cached_user_classes ⇒ Object
41 42 43 |
# File 'lib/isomorfeus/empowerment/config.rb', line 41 def cached_user_classes @cached_user_classes ||= {} end |
#current_user ⇒ Object
5 6 7 |
# File 'lib/isomorfeus/empowerment/config.rb', line 5 def current_user @current_user ||= init_current_user end |
#init_current_user ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/isomorfeus/empowerment/config.rb', line 9 def init_current_user if Isomorfeus.current_user_sid Isomorfeus.instance_from_sid(Isomorfeus.current_user_sid) else Anonymous.new end end |
#set_current_user(user) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/isomorfeus/empowerment/config.rb', line 17 def set_current_user(user) if user @current_user = user Isomorfeus.current_user_sid = user.sid else @current_user = Anonymous.new Isomorfeus.current_user_sid = nil end end |
#valid_user_class_name?(class_name) ⇒ Boolean
33 34 35 |
# File 'lib/isomorfeus/empowerment/config.rb', line 33 def valid_user_class_name?(class_name) valid_user_class_names.include?(class_name) end |
#valid_user_class_names ⇒ Object
29 30 31 |
# File 'lib/isomorfeus/empowerment/config.rb', line 29 def valid_user_class_names @valid_user_class_names ||= Set.new end |