Sha256: 2ac73952745262457b5318d77fbd9836e7b0dc0808f3d57e90cafb9cad84f50f

Contents?: true

Size: 989 Bytes

Versions: 4

Compression:

Stored size: 989 Bytes

Contents

require 'acl9/version'
require 'acl9/model_extensions'
require 'acl9/controller_extensions'
require 'acl9/helpers'

module Acl9
  CONFIG = {
    :default_role_class_name    => 'Role',
    :default_subject_class_name => 'User',
    :default_subject_method     => :current_user,
    :default_association_name   => :role_objects,
    :default_join_table_name    => nil,
    :protect_global_roles       => true,
    :normalize_role_names       => true,
  }.freeze

  class Config < Struct.new(*CONFIG.keys )
    def [] k; send k.to_sym; end
    def []= k, v; send "#{k}=", v; end
    def reset!
      Acl9::CONFIG.each do |k,v|
        send "#{k}=", v
      end
    end
  end

  @@config = Config.new( *CONFIG.values_at(*Config.members))

  mattr_reader :config

  def self.configure
    yield config
  end
end

ActiveRecord::Base.send(:include, Acl9::ModelExtensions)
AbstractController::Base.send :include, Acl9::ControllerExtensions
Acl9Helpers = Acl9::Helpers unless defined?(Acl9Helpers)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acl9-2.1.0 lib/acl9.rb
acl9-2.0.0 lib/acl9.rb
acl9-1.3.0 lib/acl9.rb
acl9-1.2.1 lib/acl9.rb