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.
53 54 55 56 |
# File 'lib/switch_user/data_source.rb', line 53 def initialize(user, source) @user = user @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
51 52 53 |
# File 'lib/switch_user/data_source.rb', line 51 def source @source end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
51 52 53 |
# File 'lib/switch_user/data_source.rb', line 51 def user @user end |
Instance Method Details
#label ⇒ Object
58 59 60 |
# File 'lib/switch_user/data_source.rb', line 58 def label user.send(source.name) end |
#scope ⇒ Object
62 63 64 |
# File 'lib/switch_user/data_source.rb', line 62 def scope source.scope end |
#scope_id ⇒ Object
66 67 68 |
# File 'lib/switch_user/data_source.rb', line 66 def scope_id "#{source.scope}_#{user.send(source.identifier)}" end |