Class: CanTango::PermissionEngine::Selector::Base

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

Direct Known Subclasses

AccountTypes, Licenses, RoleGroups, Roles, UserTypes, Users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject) ⇒ Base

Returns a new instance of Base.



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

def initialize subject
  @subject = subject
end

Instance Attribute Details

#subjectObject (readonly)

Returns the value of attribute subject.



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

def subject
  @subject
end

Instance Method Details

#select(permissions) ⇒ Object



11
12
13
# File 'lib/cantango/permission_engine/selector/base.rb', line 11

def select permissions
  permissions.select { |permission| relevant? permission }
end