Class: SwitchUser::Record
- Inherits:
-
Object
- Object
- SwitchUser::Record
- Defined in:
- lib/switch_user/data_source.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, source) ⇒ Record
constructor
A new instance of Record.
- #label ⇒ Object
- #scope ⇒ Object
- #scope_id ⇒ Object
Constructor Details
#initialize(user, source) ⇒ Record
Returns a new instance of Record.
54 55 56 57 |
# File 'lib/switch_user/data_source.rb', line 54 def initialize(user, source) @user = user @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
52 53 54 |
# File 'lib/switch_user/data_source.rb', line 52 def source @source end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
52 53 54 |
# File 'lib/switch_user/data_source.rb', line 52 def user @user end |
Instance Method Details
#label ⇒ Object
59 60 61 |
# File 'lib/switch_user/data_source.rb', line 59 def label user.send(source.name) end |
#scope ⇒ Object
63 64 65 |
# File 'lib/switch_user/data_source.rb', line 63 def scope source.scope end |
#scope_id ⇒ Object
67 68 69 |
# File 'lib/switch_user/data_source.rb', line 67 def scope_id "#{source.scope}_#{user.send(source.identifier)}" end |