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.
21 22 23 24 25 26 27 |
# File 'lib/switch_user/user_set.rb', line 21 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.
19 20 21 |
# File 'lib/switch_user/user_set.rb', line 19 def base_scope @base_scope end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
19 20 21 |
# File 'lib/switch_user/user_set.rb', line 19 def identifier @identifier end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
19 20 21 |
# File 'lib/switch_user/user_set.rb', line 19 def label @label end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
19 20 21 |
# File 'lib/switch_user/user_set.rb', line 19 def scope @scope end |
#user_class ⇒ Object (readonly)
Returns the value of attribute user_class.
19 20 21 |
# File 'lib/switch_user/user_set.rb', line 19 def user_class @user_class end |
Class Method Details
.init_from_config ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/switch_user/user_set.rb', line 5 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 |