Class: SwitchUser::UserSet
- Inherits:
-
Object
- Object
- SwitchUser::UserSet
- Defined in:
- lib/switch_user/user_set.rb
Defined Under Namespace
Classes: Record
Instance Attribute Summary collapse
-
#base_scope ⇒ Object
readonly
Returns the value of attribute base_scope.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#user_class ⇒ Object
readonly
Returns the value of attribute user_class.
Class Method Summary collapse
Instance Method Summary collapse
- #find_user(id) ⇒ Object (also: #[])
-
#initialize(scope, identifier, label, base_scope) ⇒ UserSet
constructor
A new instance of UserSet.
- #users ⇒ Object
Constructor Details
#initialize(scope, identifier, label, base_scope) ⇒ UserSet
Returns a new instance of UserSet.
18 19 20 21 22 23 24 |
# File 'lib/switch_user/user_set.rb', line 18 def initialize(scope, identifier, label, base_scope) @scope = scope @user_class = normalize_class(scope) @identifier = identifier @label = label @base_scope = normalize_scope(base_scope) end |
Instance Attribute Details
#base_scope ⇒ Object (readonly)
Returns the value of attribute base_scope.
17 18 19 |
# File 'lib/switch_user/user_set.rb', line 17 def base_scope @base_scope end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
17 18 19 |
# File 'lib/switch_user/user_set.rb', line 17 def identifier @identifier end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
17 18 19 |
# File 'lib/switch_user/user_set.rb', line 17 def label @label end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
17 18 19 |
# File 'lib/switch_user/user_set.rb', line 17 def scope @scope end |
#user_class ⇒ Object (readonly)
Returns the value of attribute user_class.
17 18 19 |
# File 'lib/switch_user/user_set.rb', line 17 def user_class @user_class end |
Class Method Details
.init_from_config ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/switch_user/user_set.rb', line 3 def self.init_from_config SwitchUser.available_users.map do |scope, base_scope| identifier = SwitchUser.available_users_identifiers[scope] label = SwitchUser.available_users_names[scope] new(scope, identifier, label, base_scope) end end |