lib/abilities.rb in abilities-5.1.1 vs lib/abilities.rb in abilities-5.1.2
- old
+ new
@@ -1,6 +1,7 @@
require 'abilities/extensions/action_controller/base'
+require 'abilities/configuration'
require 'abilities/definitions'
require 'abilities/exceptions'
require 'abilities/proxy'
require 'abilities/railtie'
require 'abilities/version'
@@ -8,11 +9,19 @@
module Abilities
class << self
attr_reader :block
+ def configuration
+ @configuration ||= Configuration.new
+ end
+
def define(&block)
@block = block
+ end
+
+ def configure
+ yield configuration
end
%i(can? cannot?).each do |name|
define_method name do |user, action, resource|
definitions = Definitions.new(user, &block)