Sha256: ed1edda9507897b3f77ef1d4b2a479a6256144efa7a9a28420f7a3582541b41f

Contents?: true

Size: 429 Bytes

Versions: 5

Compression:

Stored size: 429 Bytes

Contents

module Aclize
  class Acl
    require "aclize/acl/role"

    attr_reader :roles

    def initialize
      @roles = {
        all: Aclize::Acl::Role.new(:all)
      }.nested_under_indifferent_access
    end

    def get_acl_for(role)
      return @roles[role] || @roles[:all]
    end

    def setup(role = :all, &block)
      @roles[role] ||= Aclize::Acl::Role.new(role)
      @roles[role].instance_eval(&block)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aclize-1.0.1 lib/aclize/acl.rb
aclize-1.0.0 lib/aclize/acl.rb
aclize-0.2.2 lib/aclize/acl.rb
aclize-0.2.1 lib/aclize/acl.rb
aclize-0.2.0 lib/aclize/acl.rb