Sha256: bbdbb270dba244ec372fe6e1c5759917b8763b850fb88ef260d50e64353d6c7e
Contents?: true
Size: 698 Bytes
Versions: 11
Compression:
Stored size: 698 Bytes
Contents
# This is the abstract superclass for all roles in the hierarchy. module Arrthorizer class Role # Template method: This method is implemented in the # ContextRole subclasses and Group. def applies_to_user?(user, context = {}) raise NotImplementedError, "#{self.name} does not implement #applies_to_user?(user, context)" end def self.get(name_or_role) if name_or_role.respond_to?(:instance) get(name_or_role.instance) else registry.fetch(name_or_role) end end def self.register(role) registry.add(role) end def self.registry @registry ||= Registry.new end def to_key name end end end
Version data entries
11 entries across 11 versions & 1 rubygems