lib/acl9/controller_extensions/dsl_base.rb in acl9-1.2.1 vs lib/acl9/controller_extensions/dsl_base.rb in acl9-1.3.0
- old
+ new
@@ -1,8 +1,12 @@
+require File.expand_path '../../prepositions', __FILE__
+
module Acl9
module Dsl
class Base
+ include Prepositions
+
attr_reader :allows, :denys
def initialize(*args)
@default_action = nil
@allows = []
@@ -162,21 +166,11 @@
"#{set_of_actions}.include?(#{_action_ref})"
end
end
- VALID_PREPOSITIONS = %w(of for in on at by).freeze unless defined? VALID_PREPOSITIONS
-
def _role_object(options)
- object = nil
-
- VALID_PREPOSITIONS.each do |prep|
- if options[prep.to_sym]
- raise ArgumentError, "You may only use one preposition to specify object" if object
-
- object = options[prep.to_sym]
- end
- end
+ object = _by_preposition options
case object
when Class then object.to_s
when Symbol then _object_ref object
when nil then "nil"