Class: CanTango::PermissionEngine::Selector::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/cantango/permission_engine/selector/users.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#subject

Instance Method Summary collapse

Methods inherited from Base

#select

Constructor Details

#initialize(subject) ⇒ Users

Returns a new instance of Users.



7
8
9
10
# File 'lib/cantango/permission_engine/selector/users.rb', line 7

def initialize subject
  @user = subject.user
  @user_key = user.send(subject.user_key_field)
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'lib/cantango/permission_engine/selector/users.rb', line 5

def user
  @user
end

#user_keyObject (readonly)

Returns the value of attribute user_key.



5
6
7
# File 'lib/cantango/permission_engine/selector/users.rb', line 5

def user_key
  @user_key
end

Instance Method Details

#relevant?(permission) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/cantango/permission_engine/selector/users.rb', line 12

def relevant? permission
  permission == user_key
end