Class: SwitchUser::Record

Inherits:
Struct
  • Object
show all
Defined in:
lib/switch_user/data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



41
42
43
# File 'lib/switch_user/data_source.rb', line 41

def source
  @source
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



41
42
43
# File 'lib/switch_user/data_source.rb', line 41

def user
  @user
end

Instance Method Details

#equivalent?(other_scope_id) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/switch_user/data_source.rb', line 42

def equivalent?(other_scope_id)
  scope_id == other_scope_id
end

#labelObject



50
51
52
# File 'lib/switch_user/data_source.rb', line 50

def label
  user.send(source.name)
end

#scopeObject



54
55
56
# File 'lib/switch_user/data_source.rb', line 54

def scope
  source.scope
end

#scope_idObject



46
47
48
# File 'lib/switch_user/data_source.rb', line 46

def scope_id
  "#{source.scope}_#{user.send(source.identifier)}"
end