class Forty::Privilege::Base

Constants

PRIVILEGES

Public Class Methods

get_privilege_name_by_acronym(acronym) click to toggle source
# File lib/forty/privilege.rb, line 6
def self.get_privilege_name_by_acronym(acronym)
  privilege = self.constants.select do |constant|
    self.const_get(constant).eql?(acronym)
  end[0]
  privilege.nil? ? nil : privilege.to_s.downcase
end
parse_privileges_from_string(privileges_string) click to toggle source
# File lib/forty/privilege.rb, line 13
def self.parse_privileges_from_string(privileges_string)
  privileges = []
  self.constants.each do |constant|
    acronym = self.const_get(constant)
    unless privileges_string.slice!(acronym).nil?
      privileges << self.get_privilege_name_by_acronym(acronym)
    end
    break if privileges_string.empty?
  end
  privileges
end