Class: CanTango::Filter::Role

Inherits:
Base
  • Object
show all
Defined in:
lib/cantango/roles_ext/filter/role.rb

Instance Method Summary collapse

Constructor Details

#initialize(role, roles = nil) ⇒ Role

Returns a new instance of Role.



6
7
8
# File 'lib/cantango/roles_ext/filter/role.rb', line 6

def initialize role, roles = nil
  super
end

Instance Method Details

#excluded?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/cantango/roles_ext/filter/role.rb', line 14

def excluded?
  !excluded_roles.empty? && excluded_roles.include?(role)
end

#excluded_rolesObject



22
23
24
# File 'lib/cantango/roles_ext/filter/role.rb', line 22

def excluded_roles
  CanTango.config.roles.excluded
end

#not_only?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cantango/roles_ext/filter/role.rb', line 10

def not_only?
  !only_roles.empty? && !only_roles.include?(role)
end

#only_rolesObject



18
19
20
# File 'lib/cantango/roles_ext/filter/role.rb', line 18

def only_roles
  CanTango.config.roles.onlies
end