Sha256: 36d833ac52e767850d09edffd88602b338006a6fb3db17966101fa5ba6bb2514
Contents?: true
Size: 688 Bytes
Versions: 2
Compression:
Stored size: 688 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. 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arrthorizer-0.1.0.pre2 | lib/arrthorizer/role.rb |
arrthorizer-0.1.0.pre | lib/arrthorizer/role.rb |