Module: AuthAssistant::RoleStrategy::RolesField
- Defined in:
- lib/auth_assistant/role_strategies/roles_field.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
25 26 27 |
# File 'lib/auth_assistant/role_strategies/roles_field.rb', line 25 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#role?(role) ⇒ Boolean
13 14 15 |
# File 'lib/auth_assistant/role_strategies/roles_field.rb', line 13 def role?(role) roles.include? role.to_s end |
#roles ⇒ Object
9 10 11 |
# File 'lib/auth_assistant/role_strategies/roles_field.rb', line 9 def roles roles.split(',') end |
#roles=(*roles) ⇒ Object
5 6 7 |
# File 'lib/auth_assistant/role_strategies/roles_field.rb', line 5 def roles=(*roles) self.roles = roles.split(',').reject{|e| (e =~ /^\w+$/) == nil} end |