Module: RoleStrategy::Generic::RoleString::Implementation

Includes:
Roles::Generic::User::Implementation::Single
Defined in:
lib/roles_generic/strategy/single/role_string.rb

Instance Method Summary collapse

Methods included from Roles::Generic::User::Implementation::Single

#add_roles, #remove_roles, #roles_list

Instance Method Details

#new_role(role) ⇒ Object



10
11
12
# File 'lib/roles_generic/strategy/single/role_string.rb', line 10

def new_role role
  role.to_s
end

#new_roles(*roles) ⇒ Object



14
15
16
# File 'lib/roles_generic/strategy/single/role_string.rb', line 14

def new_roles *roles
  new_role roles.flatten.first
end

#present_role(role) ⇒ Object Also known as: present_roles



18
19
20
# File 'lib/roles_generic/strategy/single/role_string.rb', line 18

def present_role role
  role.split(',').map(&:to_sym)
end

#set_empty_roleObject



22
23
24
# File 'lib/roles_generic/strategy/single/role_string.rb', line 22

def set_empty_role
  self.send("#{role_attribute}=", "")
end