Class: CanTango::Filter::Role
- Inherits:
-
Base
- Object
- Base
- CanTango::Filter::Role
- Defined in:
- lib/cantango/roles_ext/filter/role.rb
Instance Method Summary collapse
- #excluded? ⇒ Boolean
- #excluded_roles ⇒ Object
-
#initialize(role, roles = nil) ⇒ Role
constructor
A new instance of Role.
- #not_only? ⇒ Boolean
- #only_roles ⇒ Object
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
14 15 16 |
# File 'lib/cantango/roles_ext/filter/role.rb', line 14 def excluded? !excluded_roles.empty? && excluded_roles.include?(role) end |
#excluded_roles ⇒ Object
22 23 24 |
# File 'lib/cantango/roles_ext/filter/role.rb', line 22 def excluded_roles CanTango.config.roles.excluded end |
#not_only? ⇒ 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_roles ⇒ Object
18 19 20 |
# File 'lib/cantango/roles_ext/filter/role.rb', line 18 def only_roles CanTango.config.roles.onlies end |