Module: GlobalRoles::Methods::ClassMethods

Defined in:
lib/global_roles/methods.rb

Instance Method Summary collapse

Instance Method Details

#global_role_id_for(r) ⇒ Object



36
37
38
39
40
41
# File 'lib/global_roles/methods.rb', line 36

def global_role_id_for(r)
  if !valid_role?(r)
    raise ArgumentError, "Unsupported value for `global_role': #{r.inspect}"
  end
  (r.is_a? Integer) ? r : self::ROLES.index(r)
end

#values_for_global_roleObject



32
33
34
# File 'lib/global_roles/methods.rb', line 32

def values_for_global_role
  self::ROLES
end